Skip to content

Instantly share code, notes, and snippets.

@killerwhile
Created September 26, 2015 18: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 killerwhile/1af1126f2fc195bcfdcf to your computer and use it in GitHub Desktop.
Save killerwhile/1af1126f2fc195bcfdcf to your computer and use it in GitHub Desktop.
Poor man's DNS in Ansible

If you're as lazy as I am for your cloud based pet projects, use this simple ansible play to setup a DNS-ready infrastructure :)

- lineinfile: dest=/etc/hosts regexp=".*{{ item }}.*" line="{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}" state=present
  sudo: yes
  with_items: hostvars | list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment