Skip to content

Instantly share code, notes, and snippets.

@wozz
Created September 8, 2014 16:35
Show Gist options
  • Select an option

  • Save wozz/c91426800bbaab5d81d4 to your computer and use it in GitHub Desktop.

Select an option

Save wozz/c91426800bbaab5d81d4 to your computer and use it in GitHub Desktop.
---
- 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