frr_facts and/or frr_bgp give assertionError?

73 views
Skip to first unread message

Piet Honkoop

unread,
Jun 25, 2019, 5:48:40 PM6/25/19
to Ansible Project
Trying to explore the possibilities of frr_bgp module.

If I try a task like:


  tasks:
    - name: Get setup frr
      frr_facts:
        gather_subset: all

That results in:

 File \"/tmp/ansible_frr_facts_payload_UFKM_S/ansible_frr_facts_payload.zip/ansible/module_utils/connection.py\", line 125, in __init__\r\nAssertionError: socket_path must be a value


How can I fix this?

Thanks,
Piet

Chiu Hsia Peng

unread,
Jun 25, 2019, 10:07:44 PM6/25/19
to Ansible Project
What ansible_connection are you using?
I encountered a similar problem when ansible_connection is set to local.
1. I solved the problem by setting ansible_connection to network_cli

2. adding frr to lib/ansible/config/base.yml also can solve the problem (ansible_connection is set to local)
i.e.
NETWORK_GROUP_MODULES:
  name: Network module families
  default: [..., frr]

sincerely,
Jane#

Piet Honkoop於 2019年6月26日星期三 UTC+8上午5時48分40秒寫道:

Piet Honkoop

unread,
Jun 26, 2019, 4:28:43 AM6/26/19
to Ansible Project
Hi Jane,
Thanks for the reply. Alas, it didn't work :)

A bit more on the environment I'm working with:

Got a lab setup with ubuntu 18.04 VMs with FRR 7.0 installed.

What I want to test is whether I can properly configure frr on there with ansible.

so the regular network_cli connection is likely not to work.

What confuses me is that the AssertionError seems to point to config error in the connection module (it calls Connection(module.socket_path) but socket_path is Null. The socket_path should be set somewhere, I just can't seem to find where :(

Any ideas?

Thanks,
Piet



Op woensdag 26 juni 2019 04:07:44 UTC+2 schreef Chiu Hsia Peng:

Chiu Hsia Peng

unread,
Jun 26, 2019, 6:44:44 AM6/26/19
to Ansible Project
Hi,
I noticed there is no frr.py at lib/ansible/plugins/action. 

What's the ansible_network_os ?

In my case (my customized network device, qnos) , I need add 

NETWORK_GROUP_MODULES:

  name: Network module families

  default: [..., qnos]


In this case, my ansible_network_os=qnos

And the socket_path is set at the run() at  lib/ansible/plugins/action/qnos.py. 
You can refer to the  lib/ansible/plugins/action/ios.py or the corresponding ansible_network_os file.

sincerely,
Jane#



Piet Honkoop於 2019年6月26日星期三 UTC+8下午4時28分43秒寫道:

Piet Honkoop

unread,
Jun 26, 2019, 7:34:56 AM6/26/19
to Ansible Project
Hi,

ansible_network_os is not set. 

As indicated: this is a ubuntu vm with frr installed in it, so ansible does not really recognize a network_os variant.

so it might be that frr_bgp can only be used on certain device types?

For now, I'm going to try another way of generating the proper configuration.

I've tried this on cumulus switches as well, network_os is unset there too.

Thanks,
Piet

Op woensdag 26 juni 2019 12:44:44 UTC+2 schreef Chiu Hsia Peng:

Ganesh Nalawade

unread,
Jun 26, 2019, 7:55:17 AM6/26/19
to ansible...@googlegroups.com

Please try setting below variables in inventory file: 
ansible_network_os=frr ansible_connection=network_cli

network_cli uses persistent connection and the value _socket_path is set after the connection with the remote host is successful in task_executor
Also, frr action plugin is not required for connection=network_cli

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/969767bd-c51c-4539-b4f5-b7874d6d4af1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Nilashish Chakraborty

unread,
Jun 26, 2019, 8:00:01 AM6/26/19
to ansible...@googlegroups.com
Hello,

For managing FRR using Ansible, you'd need to a have service account with the default shell set to /bin/vtysh on the VM/bare-metal server on which you've deployed FRR and use that service account credentials in your group_vars/host_vars. Essentially, if you SSH directly into your VMs using that service account, you should drop directly to the FRR shell.

You would also need to set ansible_network_os: frr and ansible_connection: network_cli

Thanks!

On Wed, Jun 26, 2019 at 5:05 PM Piet Honkoop <piet.h...@gmail.com> wrote:
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/969767bd-c51c-4539-b4f5-b7874d6d4af1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Nilashish Chakraborty

Software Engineer, Ansible

Red Hat

ncha...@redhat.com    
M: +91-8071535758    
 IM: nilashishc

Piet Honkoop

unread,
Jun 27, 2019, 5:24:04 AM6/27/19
to Ansible Project
Hi Nilashish,

Thanks! 
Helps a few good steps, but I'm still running into a wall ;(

Got this in group_vars/routers:
ansible_network_os: frr
ansible_connection: network_cli
ansible_user: frradmin


playbook router_config:
---

- hosts:
    - routers
  gather_facts: false

  tasks:
    - name: get facts of router
      frr_facts:
        gather_subset:
           - all


Gives me: 
TASK [get facts of router] ************************************************************************************
fatal: [172.31.1.71]: FAILED! => {"changed": false, "module_stderr": "/bin/sh: /usr/bin/python3: not found\n", "module_stdout": "", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127}


which is logical, because frradmin lands in vtysh directly.


Debug output shows network_cli is used:

<172.31.1.71> attempting to start connection
<172.31.1.71> using connection plugin network_cli
<172.31.1.71> local domain socket does not exist, starting it
<172.31.1.71> control socket path is /root/.ansible/pc/9845be1327
<172.31.1.71> <172.31.1.71> ESTABLISH PARAMIKO SSH CONNECTION FOR USER: frradmin on PORT 1122 TO 172.31.1.71
<172.31.1.71> connection to remote device started successfully
<172.31.1.71> local domain socket listeners started successfully
<172.31.1.71> loaded cliconf plugin for network_os frr
<172.31.1.71> ssh connection done, setting terminal
<172.31.1.71> loaded terminal plugin for network_os frr
<172.31.1.71> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<172.31.1.71> firing event: on_open_shell()
<172.31.1.71> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<172.31.1.71> ssh connection has completed successfully
<172.31.1.71>
<172.31.1.71> local domain socket path is /root/.ansible/pc/9845be1327
<172.31.1.71> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.31.1.71> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-49322nnrLjs/anble-tmp-1561626984.45-38595460168468 `" && echo ansible-tmp-1561626984.45-38595460168468="` echo /root/.ansib/tmp/ansible-local-49322nnrLjs/ansible-tmp-1561626984.45-38595460168468 `" ) && sleep 0'
Using module_utils file /usr/home/piet/down/ansible/lib/ansible/module_utils/network/__init__.py
Using module_utils file /usr/home/piet/down/ansible/lib/ansible/module_utils/basic.py
Using module_utils file /usr/home/piet/down/ansible/lib/ansible/module_utils/network/frr/frr.py



What am I doing wrong?
Please enlighten me ;)

Thanks,
Piet




Op woensdag 26 juni 2019 14:00:01 UTC+2 schreef Nilashish Chakraborty:
Hello,

For managing FRR using Ansible, you'd need to a have service account with the default shell set to /bin/vtysh on the VM/bare-metal server on which you've deployed FRR and use that service account credentials in your group_vars/host_vars. Essentially, if you SSH directly into your VMs using that service account, you should drop directly to the FRR shell.

You would also need to set ansible_network_os: frr and ansible_connection: network_cli

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Nilashish Chakraborty

unread,
Jun 27, 2019, 5:41:36 AM6/27/19
to ansible...@googlegroups.com
Hi Piet,

Could you try setting 'ansible_python_interpreter' value to point to the python executable on your controller node and check if it works?

Refer: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html (search for ansible_python_interpreter)

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Piet Honkoop

unread,
Jun 27, 2019, 6:09:35 AM6/27/19
to Ansible Project
That does the trick! 

Thanks ;)

Piet

Op donderdag 27 juni 2019 11:41:36 UTC+2 schreef Nilashish Chakraborty:

mayape mayape

unread,
Apr 27, 2020, 5:33:22 AM4/27/20
to Ansible Project
Hi all,
I'm having the same problem. Tried everything suggested here, but no luck...

This is the error message I keep receiving:

 ansible-playbook 2.9.7
  config file = /home/maya/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
Using /home/maya/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
script declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
toml declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /home/maya/ansible/hosts with yaml plugin: Syntax Error while loading YAML.   did not find expected <document start>  The error appears to be in '/home/maya/ansible/hosts':
line 2, column 1, but may be elsewhere in the file depending on the exact syntax problem.  The offending line appears to be:  [frr] cumulus01 ansible_python_interpreter=/usr/bin/python ^ here
  File "/usr/local/lib/python3.6/dist-packages/ansible/inventory/manager.py", line 280, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/inventory/yaml.py", line 105, in parse
    raise AnsibleParserError(e)
[WARNING]:  * Failed to parse /home/maya/ansible/hosts with ini plugin: /home/maya/ansible/hosts:6: Expected key=value, got: ansible_network_os: frr
  File "/usr/local/lib/python3.6/dist-packages/ansible/inventory/manager.py", line 280, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/inventory/ini.py", line 138, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /home/maya/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/default.py

PLAYBOOK: demo.yml *******************************************************************************************************************************************************************************************
Positional arguments: demo.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/maya/ansible/hosts',)
forks: 5
1 plays in demo.yml

PLAY [frr] ***************************************************************************************************************************************************************************************************
META: ran handlers

TASK [get facts of router] ***********************************************************************************************************************************************************************************
task path: /home/maya/ansible/demo.yml:6
<cumulus01> ESTABLISH SSH CONNECTION FOR USER: root
<cumulus01> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e cumulus01 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<cumulus01> (0, b'/root\n', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<cumulus01> ESTABLISH SSH CONNECTION FOR USER: root
<cumulus01> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e cumulus01 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537 && echo ansible-tmp-1587979362.872172-30103-226666053895537="` echo /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537 `" ) && sleep 0'"'"''
<cumulus01> (0, b'ansible-tmp-1587979362.872172-30103-226666053895537=/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537\n', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/network/frr/frr_facts.py
<cumulus01> PUT /root/.ansible/tmp/ansible-local-30090g37q3d_u/tmp86tlvxi7 TO /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py
<cumulus01> SSH: EXEC sshpass -d10 sftp -o BatchMode=no -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e '[cumulus01]'
<cumulus01> (0, b'sftp> put /root/.ansible/tmp/ansible-local-30090g37q3d_u/tmp86tlvxi7 /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py\n', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-...@openssh.com" revision 1\r\ndebug2: Server supports extension "sta...@openssh.com" revision 2\r\ndebug2: Server supports extension "fsta...@openssh.com" revision 2\r\ndebug2: Server supports extension "hard...@openssh.com" revision 1\r\ndebug2: Server supports extension "fs...@openssh.com" revision 1\r\ndebug3: Sent message fd 3 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /root size 0\r\ndebug3: Looking up /root/.ansible/tmp/ansible-local-30090g37q3d_u/tmp86tlvxi7\r\ndebug3: Sent message fd 3 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 32768 bytes at 0\r\ndebug3: Sent message SSH2_FXP_WRITE I:5 O:32768 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:65536 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:7 O:98304 S:16029\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 5 32768 bytes at 32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 32768 bytes at 65536\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 7 16029 bytes at 98304\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<cumulus01> ESTABLISH SSH CONNECTION FOR USER: root
<cumulus01> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e cumulus01 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/ /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py && sleep 0'"'"''
<cumulus01> (0, b'', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<cumulus01> ESTABLISH SSH CONNECTION FOR USER: root
<cumulus01> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e -tt cumulus01 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py && sleep 0'"'"''
<cumulus01> (1, b'Traceback (most recent call last):\r\n  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 102, in <module>\r\n    _ansiballz_main()\r\n  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 40, in invoke_module\r\n    runpy.run_module(mod_name=\'ansible.modules.network.frr.frr_facts\', init_globals=None, run_name=\'__main__\', alter_sys=True)\r\n  File "/usr/lib/python2.7/runpy.py", line 188, in run_module\r\n    fname, loader, pkg_name)\r\n  File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code\r\n    mod_name, mod_fname, mod_loader, pkg_name)\r\n  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code\r\n    exec code in run_globals\r\n  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 412, in <module>\r\n  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 397, in main\r\n  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 135, in __init__\r\n  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/network/frr/frr.py", line 14, in get_capabilities\r\n  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/connection.py", line 121, in __init__\r\nAssertionError: socket_path must be a value\r\n', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to cumulus01 closed.\r\n')
<cumulus01> Failed to connect to the host via ssh: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 29715
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1
Shared connection to cumulus01 closed.
<cumulus01> ESTABLISH SSH CONNECTION FOR USER: root
<cumulus01> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ServerAliveInterval=50 -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/82731db24e cumulus01 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/ > /dev/null 2>&1 && sleep 0'"'"''
<cumulus01> (0, b'', b'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.network.frr.frr_facts', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python2.7/runpy.py", line 188, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 412, in <module>
  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 397, in main
  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py", line 135, in __init__
  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/network/frr/frr.py", line 14, in get_capabilities
  File "/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/connection.py", line 121, in __init__
AssertionError: socket_path must be a value
fatal: [cumulus01]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29715\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to cumulus01 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible.modules.network.frr.frr_facts', init_globals=None, run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\r\n    fname, loader, pkg_name)\r\n  File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\r\n    mod_name, mod_fname, mod_loader, pkg_name)\r\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\r\n    exec code in run_globals\r\n  File \"/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py\", line 412, in <module>\r\n  File \"/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py\", line 397, in main\r\n  File \"/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/modules/network/frr/frr_facts.py\", line 135, in __init__\r\n  File \"/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/network/frr/frr.py\", line 14, in get_capabilities\r\n  File \"/tmp/ansible_frr_facts_payload_A4wJUl/ansible_frr_facts_payload.zip/ansible/module_utils/connection.py\", line 121, in __init__\r\nAssertionError: socket_path must be a value\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP ***************************************************************************************************************************************************************************************************
cumulus01                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

root@maya-VirtualBox:/home/maya/ansible# ansible-playbook demo.yml  -vvvv



This is the playbook demo.yml:

- hosts: frr
  gather_facts: false

  tasks:
    - name: get facts of router
      frr_facts:
        gather_subset:
           - all

And this is the hosts file:

[frr]
cumulus01 ansible_python_interpreter=/usr/bin/python

[all:vars]
ansible_user=cumulus
ansible_network_os: frr
ansible_connection: network_cli

[local]
localhost ansible_python_interpreter=/usr/bin/python3.6


Tried to make something simple here to isolate the root cause, but I ran out of ideas.
cumulus user's shell is the vtysh shell, as Nilashish Chakraborty suggested it should be.

What am I doing wrong?

Thanks in advance,
Maya.

Stefan Hornburg (Racke)

unread,
Apr 27, 2020, 5:36:47 AM4/27/20
to ansible...@googlegroups.com
On 4/27/20 11:33 AM, mayape mayape wrote:
> Hi all,
> I'm having the same problem. Tried everything suggested here, but no luck...
>

What about fixing all the inventory warnings first?

Regards
Racke
> *This is the playbook demo.yml:*
>
> - hosts: frr
>   gather_facts: false
>
>   tasks:
>     - name: get facts of router
>       frr_facts:
>         gather_subset:
>            - all
>
> *And this is the hosts file:*
>
> [frr]
> cumulus01 ansible_python_interpreter=/usr/bin/python
>
> [all:vars]
> ansible_user=cumulus
> ansible_network_os: frr
> ansible_connection: network_cli
>
> [local]
> localhost ansible_python_interpreter=/usr/bin/python3.6
>
>
> Tried to make something simple here to isolate the root cause, but I ran out of ideas.
> cumulus user's shell is the vtysh shell, as Nilashish Chakraborty suggested it should be.
>
> What am I doing wrong?
>
> Thanks in advance,
> Maya.
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/50f5f3a4-53dd-4154-b086-dd80f6e99483%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/50f5f3a4-53dd-4154-b086-dd80f6e99483%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

mayape mayape

unread,
Apr 27, 2020, 6:40:35 AM4/27/20
to Ansible Project
Hi,
Thanks for the quick response. 

Fixed the warning, but now getting another:


root@maya-VirtualBox:/home/maya/ansible# ansible-playbook demo.yml -i hosts -vvvv
ansible-playbook 2.9.7
  config file = /home/maya/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
Using /home/maya/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
script declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /home/maya/ansible/hosts as it did not pass its verify_file() method
Set default localhost to localhost
Parsed /home/maya/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/default.py

PLAYBOOK: demo.yml *******************************************************************************************************************************************************************************************
Positional arguments: demo.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/maya/ansible/hosts',)
forks: 5
1 plays in demo.yml

PLAY [frr] ***************************************************************************************************************************************************************************************************
META: ran handlers

TASK [get facts of router] ***********************************************************************************************************************************************************************************
task path: /home/maya/ansible/demo.yml:5
The full traceback is:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/ansible/executor/task_executor.py", line 146, in run
    res = self._execute()
  File "/usr/local/lib/python3.6/dist-packages/ansible/executor/task_executor.py", line 601, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/local/lib/python3.6/dist-packages/ansible/executor/task_executor.py", line 895, in _get_connection
    ansible_playbook_pid=to_text(os.getppid())
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/loader.py", line 578, in get
    obj = obj(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/connection/network_cli.py", line 331, in __init__
    self.cliconf = cliconf_loader.get(self._network_os, self)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/loader.py", line 557, in get
    self._module_cache[path] = self._load_module_source(name, path)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/loader.py", line 530, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/cliconf/frr.py", line 41, in <module>
    from ansible.module_utils.basic import get_timestamp
ImportError: cannot import name 'get_timestamp'
fatal: [cumulus01]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

PLAY RECAP ***************************************************************************************************************************************************************************************************
cumulus01                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

root@maya-VirtualBox:/home/maya/ansible#


Thanks,
Maya

mayape mayape

unread,
Apr 28, 2020, 12:07:21 PM4/28/20
to Ansible Project
Seems like there is a bug. If commenting the line "from ansible.module_utils.basic import get_timestamp" in "ansible/plugins/cliconf/frr.py" it works.
Reply all
Reply to author
Forward
0 new messages