#ansible ssh public key problem and ssh login from ansible server

1 messages · Page 1 of 1 (latest)

harsh token
#

Hi
I have a playbook , and when i try to play it i get prompt Permisison denied (publickey,passowrd,keyboard-iteractive) unreachable: true
I can login manually over ssh with user admin but when done over Ansible file i got problems, i have enabled diaguser and created a whole new user, but i cannot copy ssh keys from my server to know host when i try to save the file it say's that i don't have permisions.
Any advice how to start it from scratch my Netapp ontap virtual demo version is : NetApp Release 9.12.1 , and Ansible version is: ansible [core 2.14.1]

Thanks in advance

empty obsidian
harsh token
#

thanks for info , but this doesn't explain the connectivity problem, i have enabled user to be accessible over http api and ssh

empty obsidian
#

is https enabled

#

system services web modify -http-enabled true
this for enable https, not sure this will fix, but we can try

harsh token
#

I only get :> system services web modify -external, I cannot finish with -hhtp....

empty obsidian
#

we can check https are enabled using the command
system services web show

harsh token
#

LS01-CL::storage firmware> system services web show
External Web Services: true
Status: online
HTTP Protocol Port: 80
HTTPS Protocol Port: 443
HTTP Enabled: false

empty obsidian
#

can you share the playbook, it will help to check

harsh token
#

This is main play book :

  • name: Create NetApp volume
    hosts: netapp
    gather_facts: no
    vars:
    svm_name: "backend"
    vol_name: "adblock_2023Q1"
    aggr_list: ["data01", "data02"]
    junction_path: "/adblocks/{{ vol_name }}"
    policy: "blocks"
    tasks:
    • name: Create volume on NetApp SVM
      na_ontap_volume:
      state: present
      svm: "{{ svm_name }}"
      name: "{{ vol_name }}"
      aggregates: "{{ aggr_list }}"
      junction_path: "{{ junction_path }}"
      policy: "{{ policy }}"
      validate_certs: false
      **This is inventory file **

[netapp]
192.168.227.108 ansible_user=vsadmin ansible__pasword=pas01pas

And this is command :
ansible-playbook 001_create-aggregate.yml -i inventory.ini -vvv

#

And tih is the error what i get
ansible-playbook [core 2.14.1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /ansible/netapp/inventory.ini as it did not pass its verify_file() method
script declined parsing /ansible/netapp/inventory.ini as it did not pass its verify_file() method
auto declined parsing /ansible/netapp/inventory.ini as it did not pass its verify_file() method
yaml declined parsing /ansible/netapp/inventory.ini as it did not pass its verify_file() method
Parsed /ansible/netapp/inventory.ini inventory source with ini plugin
redirecting (type: modules) ansible.builtin.na_ontap_volume to netapp.ontap.na_ontap_volume
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: 001_create-aggregate.yml ******************************************************************************************************************************************
1 plays in 001_create-aggregate.yml

PLAY [Create NetApp volume] *************************************************************************************************************************************************

TASK [Create volume on NetApp SVM] ******************************************************************************************************************************************
task path: /ansible/netapp/001_create-aggregate.yml:

#

redirecting (type: modules) ansible.builtin.na_ontap_volume to netapp.ontap.na_ontap_volume
<192.168.227.108> ESTABLISH SSH CONNECTION FOR USER: vsadmin
<192.168.227.108> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vsadmin"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/d2780aa9fe"' 192.168.227.108 '/bin/sh -c '"'"'echo ~vsadmin && sleep 0'"'"''
<192.168.227.108> (255, b'', b'vsadmin@192.168.227.108: Permission denied (publickey,password,keyboard-interactive).\r\n')
fatal: [192.168.227.108]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: vsadmin@192.168.227.108: Permission denied (publickey,password,keyboard-interactive).",
"unreachable": true
}

PLAY RECAP ******************************************************************************************************************************************************************
192.168.227.108 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

empty obsidian
#

playbook requires few modifications

ONTAP Ansible modules are run locally, so hosts should be set to localhost.
hosts: localhost

also hostname and (username, password or keypaths) requires for connecting to ONTAP.

`---

  • name: Create NetApp volume
    hosts: localhost
    gather_facts: no
    vars:
    svm_name: "backend"
    vol_name: "adblock_2023Q1"
    aggr_list: ["data01", "data02"]
    junction_path: "/adblocks/{{ vol_name }}"
    policy: "blocks"
    tasks:
    • name: Create volume on NetApp SVM
      na_ontap_volume:
      state: present
      hostname: "{{provide host ip here}}"
      username: "{{username}}"
      password: "{{password}}"
      svm: "{{ svm_name }}"
      name: "{{ vol_name }}"
      aggregates: "{{ aggr_list }}"
      junction_path: "{{ junction_path }}"
      policy: "{{ policy }}"
      validate_certs: false`
harsh token
#

i have used and tweaked that playbook it seems that is working but now i have another problem that i cannot create volume on multiple aggregates, this is my playbook :


  • name: Create NetApp volume
    hosts: localhost
    gather_facts: no
    vars:
    svm_name: "backend01"
    vol_name: "adblock_2023Q4"
    vserver_name: "backend01"
    aggregate_list:
    - "data02"
    - "data04"
    junction_path: "/adblocks/{{ vol_name }}"
    policy: "blocks"
    volume_security_style: "unix"
    tasks:
    • name: Create volume on NetApp SVM
      na_ontap_volume:
      state: present
      hostname: "192.168.227.108"
      username: "admin"
      password: "pas01pas"
      vserver: "{{vserver_name}}"
      name: "{{vol_name}}"
      aggregate_name: "{{aggregate_list}}"
      volume_security_style: "{{volume_security_style}}"
      size: 100
      junction_path: "{{junction_path}}"
      policy: "{{policy}}"
      validate_certs: false

And this is the error that i get:

msg": "Error creating volume adblock_2023Q4: calling: storage/volumes: got {'message': 'failed to set field "aggregates[0].name" to "[\'data02\', \'data04\']"', 'code': '2', 'target': 'aggregates[0].name'}."
}

atomic shale
empty obsidian
#

@harsh token can try with aggr_list instead aggregate_name if you have more one aggregate in create.