Did something change in 2.3 when using iosxr_command?

105 views
Skip to first unread message

jo...@sanren.ac.za

unread,
Apr 3, 2017, 10:27:27 AM4/3/17
to Ansible Project
Hi All,

I have this playbook that is using iosxr_command to do a show version, and it is working with 2.2.2.0, but fails with 2.3RC3. Do I have to add / change something? This playbook with iosxr_command changed to sros_command does work to an alcatel lucent router.

#### playbook #####
---
- name: Testing ansible to XR
  hosts: 10.1.2.3
  connection: local
  gather_facts: false

  tasks:
  - name: Obtain login Credentials
    no_log: True
    include_vars: secrets.yaml

  - name: Define Provider
    no_log: True
    set_fact:
      provider:
        host: "{{ inventory_hostname }}"
        username: "{{ creds['username'] }}"
        password: "{{ creds['password'] }}"

  - name: run show version on remote devices
    iosxr_command:
      commands:
        - show version
      provider: "{{ provider }}"
    register: ver_out

  - name: display version
    debug:
      var: ver_out
########################

$ ansible-playbook --version
ansible-playbook 2.3.0.0 (stable-2.3 f15e1f25ae) last updated 2017/03/31 21:28:14 (GMT +200)
  config file = /home/jhay/ansible23/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Feb 25 2017, 01:20:24) [GCC 4.2.1 Compatible FreeBSD Clang 3.8.0 (tags/RELEASE_380/final 262564)]

$ ansible-playbook -vvvvvvv -i sanrenhosts try-xr.yml
Using /home/jhay/ansible23/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /home/jhay/progs/ansible/lib/ansible/plugins/callback/__init__.pyc

PLAYBOOK: try-xr.yml ***************************************************************************
1 plays in try-xr.yml

PLAY [Testing ansible to XR] *******************************************************************
META: ran handlers

TASK [Obtain login Credentials] ****************************************************************
task path: /home/jhay/ansible23/try-xr.yml:8
looking for "secrets.yaml" at "/home/jhay/ansible23/vars/secrets.yaml"
looking for "secrets.yaml" at "/home/jhay/ansible23/secrets.yaml"
ok: [10.1.2.3] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}

TASK [Define Provider] *************************************************************************
task path: /home/jhay/ansible23/try-xr.yml:12
ok: [10.1.2.3] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}

TASK [run show version on remote devices] ******************************************************
task path: /home/jhay/ansible23/try-xr.yml:20
<10.1.2.3> calling open_shell()
Using module file /home/jhay/progs/ansible/lib/ansible/modules/network/iosxr/iosxr_command.py
<10.1.2.3> ESTABLISH LOCAL CONNECTION FOR USER: jhay
<10.1.2.3> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.1.2.3> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316 `" && echo ansible-tmp-1491033014.34-242761734218316="` echo /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316 `" ) && sleep 0'
<10.1.2.3> PUT /tmp/tmp8dm40s TO /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316/iosxr_command.py
<10.1.2.3> EXEC /bin/sh -c 'chmod u+x /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316/ /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316/iosxr_command.py && sleep 0'
<10.1.2.3> EXEC /bin/sh -c '/usr/bin/python /home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316/iosxr_command.py; rm -rf "/home/jhay/.ansible/tmp/ansible-tmp-1491033014.34-242761734218316/" > /dev/null 2>&1 && sleep 0'
fatal: [10.1.2.3]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "commands": [
                "show version"
            ],
            "host": null,
            "interval": 1,
            "match": "all",
            "password": null,
            "port": null,
            "provider": {
                "host": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
            },
            "retries": 10,
            "ssh_keyfile": null,
            "timeout": null,
            "username": null,
            "wait_for": null
        }
    },
    "msg": "{'answer': None, 'command': '{\"answer\": null, \"command\": \"show version\", \"promp\r\n^                                                                              \r\nt\": null}', 'prompt': None}\r\n\r\n% Invalid input detected at '^' marker.\r\nRP/0/RP0/CPU0:PTA1-P1#",
    "rc": 1
}
        to retry, use: --limit @/home/jhay/ansible23/try-xr.retry

PLAY RECAP *************************************************************************************
10.1.2.3            : ok=2    changed=0    unreachable=0    failed=1  

################

Regards

John

jo...@sanren.ac.za

unread,
Apr 6, 2017, 2:38:50 PM4/6/17
to Ansible Project
Reply all
Reply to author
Forward
0 new messages