frr_facts and/or frr_bgp give assertionError?

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

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秒寫道:

Hi Jane,
Thanks for the reply. Alas, it didn’t work :slight_smile:

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 :frowning:

Any ideas?

Thanks,
Piet

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秒寫道:

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

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

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!

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:

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!

That does the trick!

Thanks :wink:

Piet

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 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
ESTABLISH SSH CONNECTION FOR USER: root
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’”’“‘’
(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’)
ESTABLISH SSH CONNECTION FOR USER: root
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’“'”‘’
(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
PUT /root/.ansible/tmp/ansible-local-30090g37q3d_u/tmp86tlvxi7 TO /root/.ansible/tmp/ansible-tmp-1587979362.872172-30103-226666053895537/AnsiballZ_frr_facts.py
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]’
(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-rename@openssh.com” revision 1\r\ndebug2: Server supports extension “statvfs@openssh.com” revision 2\r\ndebug2: Server supports extension “fstatvfs@openssh.com” revision 2\r\ndebug2: Server supports extension “hardlink@openssh.com” revision 1\r\ndebug2: Server supports extension “fsync@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’)
ESTABLISH SSH CONNECTION FOR USER: root
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’”’“‘’
(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’)
ESTABLISH SSH CONNECTION FOR USER: root
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’“'”‘’
(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 \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 \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’)
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.
ESTABLISH SSH CONNECTION FOR USER: root
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’”’"‘’
(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
_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
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 \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 \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.

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

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 “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/usr/local/lib/python3.6/dist-packages/ansible/plugins/cliconf/frr.py”, line 41, in
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

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.