-
Notifications
You must be signed in to change notification settings - Fork 112
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
Issues using with_items with from a list of dictionary #148
Comments
I am using a custom index file, and a custom template. The problem is not with that, the problem I am having is with being a pull the interfaces dynamically and then use them with with_items. Basically following the example Jason posted in the link below. |
Hi @lmshippy, Can you show the output running in verbose mode or add a task like this:
And do this after your set_fact task. Show us this output. Thanks. |
Actually something seems off. You did a debug and you're still seeing the
|
Here is the new playbook and below is the debug output.
|
Looks like it worked...what am I missing? If you add a |
Actually looking, you are correct, the information is in there. The file we were creating was putting in a bunch of extra stuff at the top but we were able to figure it out. Quick question, with the loop it is reconnecting to the device each time for the looped command, is there any way to have it maintain the connection for the loop? |
Hey @lmshippy , this is not possible yet, but it's a feature we will release in the future :) |
I am trying to use the show ip int brief command and then use a variable from it do a show run int {{ variable }} Below is my code. I am wanting to reference one key out the list of dictionaries but not able to get it to work.
name: COLLECT DATA TEST
hosts: iosrouters
gather_facts: no
connection: local
tasks:
name: GET INTERFACES
ntc_show_command:
connection=ssh
platform={{ vendor }}{{ os }}{{ api }}
index_file=index
template_dir=/usr/lib/python2.7/dist-packages/ansible/modules/ntc-ansible/ntc-templates/templates
command='show ip int brief'
host={{ inventory_hostname }}
username={{ un }}
password={{ pwd }}
tags: test
register: interfaces
name: SET FACT
set_fact:
interface: "{{ interfaces.response }}"
tags: test
name: GET INTERFACES
ntc_show_command:
connection=ssh
platform={{ vendor }}{{ os }}{{ api }}
index_file=interface.index
template_dir=/usr/lib/python2.7/dist-packages/ansible/modules/ntc-ansible/ntc-templates/templates
command="show run int {{ item.intf }}" <--- where I am having issues tried
host={{ inventory_hostname }}
username={{ un }}
password={{ pwd }}
tags: test
with_items: "{{ interface }}"
register: interfaceinfo
The text was updated successfully, but these errors were encountered: