I am trying to backup my config on a router
but I want to use the login details on the router for ansible e.g admin as written below to use to log into the router and not the ansible user on the ansible server
Please tell me how I can do this .
when this playbook is run it uses the ansible user to log in
name: collect default set of facts
hosts: 10.101.250.41
tasks:
name: collect default sets of facts and configuration
junos_facts:
gather_subset: config
username: admin
password: xxxxx
ansible@ansible-new:/etc/ansible$ ansible-playbook -i hosts backup_config-junos-facts.yml
PLAY [collect default set of facts] ********************************************
TASK [Gathering Facts] *********************************************************
fatal: [10.101.250.41]: FAILED! => {“msg”: “failed to transfer file to /tmp/tmpoJI85F error: unknown command: /bin/sh/setup.py:\n\nscp: error: unknown command: /bin/sh/setup.py: No such file or directory\n”}
[WARNING]: Could not create retry file ‘/etc/ansible/backup_config-junos-
facts.retry’. [Errno 13] Permission denied: u’/etc/ansible
/backup_config-junos-facts.retry’
PLAY RECAP *********************************************************************
10.101.250.41 : ok=0 changed=0 unreachable=0 failed=1
ansible@ansible-new:/etc/ansible$ tail -f ansible.log 2018-02-12 14:48:12,297 p=31643 u=ansible | 10.101.250.41 : ok=0 changed=0 unreachable=0 failed=1
2018-02-12 14:52:07,004 p=31666 u=ansible | PLAY [collect default set of facts] ********************************************
2018-02-12 14:52:07,011 p=31666 u=ansible | TASK [Gathering Facts] *********************************************************
2018-02-12 14:52:12,906 p=31666 u=ansible | fatal: [10.101.250.41]: FAILED! => {“msg”: “failed to transfer file to /tmp/tmpoJI85F error: unknown command: /bin/sh/setup.py:\n\nscp: error: unknown command: /bin/sh/setup.py: No such file or directory\n”}
2018-02-12 14:52:12,908 p=31666 u=ansible | [WARNING]: Could not create retry file ‘/etc/ansible/backup_config-junos-
facts.retry’. [Errno 13] Permission denied: u’/etc/ansible
/backup_config-junos-facts.retry’
2018-02-12 14:52:12,908 p=31666 u=ansible | PLAY RECAP *********************************************************************
2018-02-12 14:52:12,908 p=31666 u=ansible | 10.101.250.41 : ok=0