Загрузка файла в Nexus 9000 с помощью Ansible Playbook - PullRequest
0 голосов
/ 09 ноября 2018

Попытка автоматизировать процесс загрузки файлов на устройство Cisco Nexus 9000 с помощью Ansible Playbook.

- name: Upload File to Nexus Device
  gather_facts: no
  hosts: localhost
  connection: local

  tasks:
    - name: Uploading file 
      nxos_file_copy:
        provider:
          username: admin
          ssh_keyfile: "files/id_rsa"
          host: 192.168.0.100
          validate_certs: no
          transport: cli
        local_file: "config.txt"
        remote_file: "config.txt"

При запуске playbook я получаю следующую ошибку

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py", line 255, in <module>
    main()
  File "/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py", line 245, in main
    transfer_file(module, dest)
  File "/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py", line 174, in transfer_file
    port=port)
  File "/home/user/venv/ansible-cox/local/lib/python2.7/site-packages/paramiko/client.py", line 424, in connect
    passphrase,
  File "/home/user/venv/ansible-cox/local/lib/python2.7/site-packages/paramiko/client.py", line 714, in _auth
    raise saved_exception
paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted

fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py\", line 255, in <module>\n    main()\n  File \"/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py\", line 245, in main\n    transfer_file(module, dest)\n  File \"/tmp/ansible_4UEm25/ansible_module_nxos_file_copy.py\", line 174, in transfer_file\n    port=port)\n  File \"/home/user/venv/ansible-cox/local/lib/python2.7/site-packages/paramiko/client.py\", line 424, in connect\n    passphrase,\n  File \"/home/user/venv/ansible-cox/local/lib/python2.7/site-packages/paramiko/client.py\", line 714, in _auth\n    raise saved_exception\nparamiko.ssh_exception.PasswordRequiredException: Private key file is encrypted\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 1
}

При SSH-входе с локального терминала с тем же ключом работает

(ansible) ~/B/c/Ansible on master ⨯ ssh admin@192.168.0.100 -i files/id_rsa
User Access Verification
NX9K#

Я использую версию Ansible 2.5.4. Любая помощь с благодарностью!

...