Skip to content

Instantly share code, notes, and snippets.

@marzdgzmn
Created May 3, 2019 11:09
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 marzdgzmn/de01f5dfdf15a984f8a98f60eeb8706d to your computer and use it in GitHub Desktop.
Save marzdgzmn/de01f5dfdf15a984f8a98f60eeb8706d to your computer and use it in GitHub Desktop.
become: yes
vars:
internal_addresses:
- 10.0.0.0
- 172.16.0.0
tasks:
- name: debug
debug:
msg: "{{item}}"
when: "{{ hostvars[inventory_hostname]['ansible_' + item]['ipv4']['address'] is select('match', internal_addresses) }}"
loop: "{{ ansible_interfaces }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment