Skip to content

Instantly share code, notes, and snippets.

@wozz
Created September 8, 2014 15:47
Show Gist options
  • Select an option

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

Select an option

Save wozz/8a1506b00058a9b4c84d 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
- shell: dig +short <my home dns> @resolver1.opendns.com
register: homeip
- set_fact: home="{{ myip.stdout == homeip.stdout }}"
- name: Update pi
hosts: pi
gather_facts: false
tasks:
- debug: msg="{{ ansible_facts.home }}"
- include: tasks/update.yml
when: ansible_facts.home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment