Use iosxr_command not ios_command when configuring IOS-XR devices
On Wed, Dec 21, 2016 at 3:09 PM, Eliezer Rodriguez <[email protected]>
wrote:
> Hi,
>
> I'm using the ios_command and it seems it's not entering privileged mode,
> the traceback shows it issuing a "term length 0" commands that fails,
> because it's being issued in EXEC mode I believe.
>
> The trace follows:
>
> An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 237, in <module>
> main()
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 139, in receive
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 186, in find_prompt
> ansible.module_utils.shell.ShellError: matched error in response:
> terminal length 0
> ^
> % Invalid input detected at '^' marker.
>
> m1.dca2>
>
> fatal: [m1.dca2.plx]: FAILED! => {
> "changed": false,
> "failed": true,
> "invocation": {
> "module_name": "ios_command"
> },
> "module_stderr": "Traceback (most recent call last):\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 237, in <module>\n main()\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 200, in main\n runner.add_command(**cmd)\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/netcli.py\", line 147, in add_command\n
> File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 117, in cli\n File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 148, in connect\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 181, in connect\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 153, in send\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 139, in receive\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 186, in
> find_prompt\nansible.module_utils.shell.ShellError: matched error in
> response: terminal length 0\r\n ^\r\n% Invalid input detected at '^'
> marker.\r\n\r\nm1.dca2>\n",
> "module_stdout": "",
> "msg": "MODULE FAILURE"
> }
> An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 237, in <module>
> main()
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 139, in receive
> File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 186, in find_prompt
> ansible.module_utils.shell.ShellError: matched error in response:
> terminal length 0
> ^
> % Invalid input detected at '^' marker.
>
> m2.dca2>
>
> fatal: [m2.dca2.plx]: FAILED! => {
> "changed": false,
> "failed": true,
> "invocation": {
> "module_name": "ios_command"
> },
> "module_stderr": "Traceback (most recent call last):\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_module_ios_command.py\",
> line 237, in <module>\n main()\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_module_ios_command.py\",
> line 200, in main\n runner.add_command(**cmd)\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_
> modlib.zip/ansible/module_utils/netcli.py\", line 147, in add_command\n
> File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 117, in cli\n File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 148, in connect\n File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 181, in connect\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 153, in send\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 139, in receive\n File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_js6YVM/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 186, in
> find_prompt\nansible.module_utils.shell.ShellError: matched error in
> response: terminal length 0\r\n ^\r\n% Invalid input detected at '^'
> marker.\r\n\r\nm2.dca2>\n",
> "module_stdout": "",
> "msg": "MODULE FAILURE"
> }
> And this is the playbook I'm using:
>
> ---
> - hosts: all
> gather_facts: false
> connection: local
>
> vars:
> to_router:
> host: "{{ inventory_hostname }}"
> username: myusername
> password: .........
> authorize: true
> auth_pass: .........
> transport: cli
> tasks:
> - name: show IOS XR version
> ios_command:
> commands:
> - show version
> provider: "{{ to_router }}"
> register:
> ios_commands_result
> - debug: var=ios_commands_result.stdout_lines
> ...
>
>
> I"m using ansible 2.0 on Mac OS:
>
> $ ansible --version
> ansible 2.2.0.0
> config file =
> configured module search path = Default w/o overrides
>
>
> Any thougths ? It seems as if the "authorize" option was not beeing
> honored.
>
>
> Eliezer R.
>
> --
> 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/6d266492-dac1-46e7-8470-2bc9250375cd%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/6d266492-dac1-46e7-8470-2bc9250375cd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAEkdrMiqSfA4dkM3dn-%3De%3DYbTPcbXcYChFOuyRbZum3AA3LqGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.