Skip to content

Instantly share code, notes, and snippets.

@ktbyers
Created April 5, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktbyers/93424d1c99c435ae9f0096ed9b4604fc to your computer and use it in GitHub Desktop.
Save ktbyers/93424d1c99c435ae9f0096ed9b4604fc to your computer and use it in GitHub Desktop.
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