0

I'm trying to use Textfsm in a playbook I'm writing.

- name: PLAY1 - Gather Data
  hosts: cisco_ios_switches
  gather_facts: False

  tasks: 
    - name: Get CDP Facts
      ios_command:
        commands:
        - show cdp nei details
      register: cdp_nei_output

    - name: "TASK 2: REGISTER OUTPUT TO DEVICE_NEIGHBORS VARIABLE"
      set_fact:
        device_neighbors: "{{ lldp_output.stdout[0] | parse_cli_textfsm('~/ansible-dev/modules/textfsm/ntc-templates/templates/cisco_ios_show_cdp_neighbors_detail.textfsm') }}"

    - name: "TASK 3: PRINT OUTPUT"
      debug:
        msg: "{{ device_neighbors }}"

Each time I run the playbook I get the error message. {"msg": "parse_cli_textfsm filter requires TextFSM library to be installed"}

I've done a pip install of Textfsm. I'm using Centos.

The interpreter is set as [all:vars] ansible_python_interpreter="/usr/bin/python3"

ansible.cfg contains

interpreter_python = /usr/bin/python
gathering = explicit
inventory = inv.yml
retry_files_enabled = False
host_key_checking = False
filter_plugins = plugins/filter/
log_path = /var/log/ansible.log
library = /home/XXXXXXX/ansible-dev/modules 
action_plugins = ../napalm_ansible/plugins/action```

Textfsm is installed in modules directory.
Ansible is running inside a virtualenv.

ansible 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/XXXXXX/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)


Modo
  • 21
  • 2

1 Answers1

0

Q: ""parse_cli_textfsm filter requires TextFSM library to be installed"

A: Install Centos package python-textfsm. The paths were not set properly by pip, I guess.

Vladimir Botka
  • 58,131
  • 4
  • 32
  • 63
  • I tried install the centos package after searching for instructions. I downloaded the file to the local Downloads directory and then ran the following command. rpm –i python-textfsm-0.3.2-9.el8.src.rpm I seem to just get usage information back. However a – Modo Apr 16 '20 at 11:05