Options like "host" and "username" are part of provider option. You
should check the options and also the indentation.

On Wed, Mar 21, 2018 at 7:54 PM,  <[email protected]> wrote:
> Hi Everyone!
>
> 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 :
>
>    [WARNING]: Ignoring invalid attribute: username
>
>  [WARNING]: Ignoring invalid attribute: authorize
>
>  [WARNING]: Ignoring invalid attribute: auth_pass
>
>  [WARNING]: Ignoring invalid attribute: host
>
> here is playbook:
>
> ---
> - hosts: myswitches
>   gather_facts: true
>   connection: local
>
>   tasks:
>    - name: show run
>      ios_command:
>        commands:
>        - show run
>      host: "{{ inventory_hostname }}"
>      auth_pass: cisco
>      username: cisco
>      password: cisco
>      authorize: yes
>      #provider:
>      #  authorize: yes
>      #  auth_pass: cisco
>      #register: config
>
>    - name: save output to /etc/ansible/backups
>      copy:
>        content: "{{ config.stdout[0] }}"
>        dest: "/etc/ansible/backups/show_run_{{ inventory_hostname }}.txt"
>
>
> here is -VVVV outcome:
>
>
> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5d40e86a-8168-4008-95dc-3309594a4ae1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Marcos H. Alano
Linux System Administrator
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAO3Us%3Dn9aQWJkrWcCxkgtVhvRB2Fh9%3DpaJT%2B5SSbqdy2w9ycNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to