Я пытаюсь использовать Textfsm в пьесе, которую я пишу.
- 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 }}"
Каждый раз, когда я запускаю книгу, я получаю сообщение об ошибке. {"msg": "Фильтру parse_cli_textfsm требуется установить библиотеку TextFSM"}
Я выполнил установку Textfsm в пипсах. Я использую Centos.
Для интерпретатора задано [all: vars] ansible_python_interpreter = "/ usr / bin / python3"
ansible .cfg содержит
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)