Created
April 5, 2017 20:57
-
-
Save ktbyers/93424d1c99c435ae9f0096ed9b4604fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks: | |
- ios_facts: | |
provider: "{{ creds }}" | |
- ios_config: | |
provider: "{{ creds }}" | |
lines: | |
- ip helper-address 1.1.1.1 | |
parents: interface {{ item }} | |
with_items: "{{ dhcp_interfaces }}" | |
- name: Check for extra DHCP helpers | |
ios_command: | |
provider: "{{ creds }}" | |
commands: | |
- "show run interface {{ item }}" | |
with_items: "{{ ansible_net_interfaces }}" | |
register: new_output | |
- debug: | |
var: item | |
when: '"helper" in item.stdout[0]' | |
with_items: "{{ new_output.results }}" | |
register: new_output2 | |
- assert: | |
that: '{{ new_output2.results | selectattr("skipped", "undefined") | map(attribute="item.item") | list | symmetric_difference(dhcp_interfaces) }} == []' | |
msg: "Interface has 'ip helper' configured and shouldn't" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment