Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No example how to use textfsm with network-engine. #200

Closed
jwoogee opened this issue Nov 21, 2018 · 6 comments
Closed

No example how to use textfsm with network-engine. #200

jwoogee opened this issue Nov 21, 2018 · 6 comments
Assignees

Comments

@jwoogee
Copy link
Contributor

jwoogee commented Nov 21, 2018

ISSUE TYPE

  • Documentation Report

ANSIBLE VERSION

ansible --version
ansible 2.7.0
  config file = /Users/z003gn3/ansible_config/ansible.cfg
  configured module search path = [u'/Users/z003gn3/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/z003gn3/virtualenvs/venv_lan_ansible/lib/python2.7/site-packages/ansible
  executable location = /Users/z003gn3/virtualenvs/venv_lan_ansible/bin/ansible
  python version = 2.7.10 (default, Oct  6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]

ansible-galaxy list | grep ansible.network

- ansible-network.network-engine, v2.7.0
- ansible-network.cisco_ios, v2.6.2

Network OS

  • Operating System (inc version) of machine running Ansible
  • Network device make/model, including version

SUMMARY

I'm trying to use a textfsm template with network-engine to populate ansible_facts. I cannot find documentation how to supply the fact name to supply, and the facts are not showing in ansible_facts.

I added show_interfaces_status.template to parser_templates/cli folder. I'm just not sure how to register that json dictionary now.

STEPS TO REPRODUCE

# I added this to vars/get_facts_command_map.yaml
- command: show interfaces status
  parser: show_interfaces_status.template
  groups:
    - all
    - default
  engine: textfsm_parser

EXPECTED RESULTS

I expect ansible facts to be populated.

ACTUAL RESULTS

command runs without issue, but ansible_facts aren't updated. It's pretty clear I'm not setting the facts through the course of this, but I don't know how I'm supposed to using textfsm vs command_parser.


@trishnaguha
Copy link
Member

trishnaguha commented Nov 22, 2018

@jwoogee Hi, your playbook is not explicit enough to understand what module you are using. Will you please add the information?
We do have docs how to use the parsers https://github.com/ansible-network/network-engine/tree/devel/docs/user_guide

textfsm_parser needs an argument called name to have ansible_facts generated https://github.com/ansible-network/network-engine/blob/devel/docs/user_guide/textfsm_parser.md#sample-playbooks

@jwoogee
Copy link
Contributor Author

jwoogee commented Nov 22, 2018 via email

@jwoogee
Copy link
Contributor Author

jwoogee commented Nov 23, 2018

I found the issue, the ansible-network.cisco_ios role doesn't have a spot to use name for textfsm templates, and the cli module in ansible-network.network-engine doesn't take name and use it either, so as far as I can see you can't use textfsm in the way the ciso_ios role expects. I can submit a PR with my changes that made it work for me.

@trishnaguha
Copy link
Member

Thanks for the details. This needs to be fixed in cli action plugin instead. I will open a PR when the fix is ready.

@jwoogee
Copy link
Contributor Author

jwoogee commented Nov 24, 2018 via email

@trishnaguha trishnaguha self-assigned this Nov 28, 2018
@trishnaguha
Copy link
Member

resolved by pr #202 and #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants