I am new to "Ansible". I've created a playbook that backups cisco running config. My problem is that i get an error Invalid input detector "^" i did some digging and its alerting due to the command not running in privileged mode. I've tried using authorize and auth_pass and it gives me an error saying :
ansible-playbook backups_test.yml -vvvv
ansible-playbook 2.4.3.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/techops/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Set default localhost to 127.0.0.1
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: Ignoring invalid attribute: username
[WARNING]: Ignoring invalid attribute: authorize
[WARNING]: Ignoring invalid attribute: auth_pass
[WARNING]: Ignoring invalid attribute: host
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc
PLAYBOOK: backups_test.yml **************************************************************************************************************************************************************
1 plays in backups_test.yml
PLAY [myswitches] ***********************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<10.175.0.238> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.175.0.238> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<10.175.0.234> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.175.0.234> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
ok: [10.175.0.234]
ok: [10.175.0.238]
META: ran handlers
TASK [show run] *************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/backups_test.yml:7
<10.175.0.238> using connection plugin network_cli
<10.175.0.234> using connection plugin network_cli
<10.175.0.238> socket_path: /home/techops/.ansible/pc/3b9c1a1e70
<10.175.0.234> socket_path: /home/techops/.ansible/pc/606d5c5780
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/network/ios/ios_command.py
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/network/ios/ios_command.py
<10.175.0.238> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.175.0.238> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
<10.175.0.234> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.175.0.234> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
failed: [10.175.0.238] (item=OVuq7syghNs824LrXc7d) => {
"changed": false,
"invocation": {
"module_args": {
"auth_pass": null,
"authorize": null,
"commands": [
"show run"
],
"host": null,
"interval": 1,
"match": "all",
"password": null,
"port": null,
"provider": null,
"retries": 10,
"ssh_keyfile": null,
"timeout": null,
"username": null,
"wait_for": null
}
},
"item": "OVuq7syghNs824LrXc7d",
"msg": "show run\r\n ^\r\n% Invalid input detected at '^' marker.\r\n\r\nATL-INT-SW-09>",
"rc": 1
}
failed: [10.175.0.234] (item=OVuq7syghNs824LrXc7d) => {
"changed": false,
"invocation": {
"module_args": {
"auth_pass": null,
"authorize": null,
"commands": [
"show run"
],
"host": null,
"interval": 1,
"match": "all",
"password": null,
"port": null,
"provider": null,
"retries": 10,
"ssh_keyfile": null,
"timeout": null,
"username": null,
"wait_for": null
}
},
"item": "OVuq7syghNs824LrXc7d",
"msg": "show run\r\n ^\r\n% Invalid input detected at '^' marker.\r\n\r\nATL-INT-SW-05>",
"rc": 1
}
to retry, use: --limit @/etc/ansible/playbooks/backups_test.retry
PLAY RECAP ******************************************************************************************************************************************************************************
10.175.0.234 : ok=1 changed=0 unreachable=0 failed=1
10.175.0.238 : ok=1 changed=0 unreachable=0 failed=1