Skip to content

Instantly share code, notes, and snippets.

@wozz
Created September 8, 2014 16:35
---
- name: Determine if Home
hosts: localhost
gather_facts: false
tasks:
- shell: dig +short myip.opendns.com @resolver1.opendns.com
register: myip
changed_when: false
- shell: dig +short <home dns> @resolver1.opendns.com
register: homeip
changed_when: false
- name: Update servers
hosts: all
gather_facts: false
tasks:
- include: tasks/update.yml
when: "{{ home_ is not defined or hostvars['localhost']['homeip']['stdout'] == hostvars['localhost']['myip']['stdout'] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment