简体   繁体   中英

parse_cli_textfsm filter requires TextFSM library to be installed

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)


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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM