Skip to content

Instantly share code, notes, and snippets.

@CaptTofu
Last active March 21, 2016 19:38
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 CaptTofu/2093f8cac2228a81a0a4 to your computer and use it in GitHub Desktop.
Save CaptTofu/2093f8cac2228a81a0a4 to your computer and use it in GitHub Desktop.
---
- name: Create a docker.yml file
hosts: "{{ hosts }}"
gather_facts: yes
tasks:
- name: inventory template
local_action: template src=docker.inv.j2 dest=./docker.inv
and the template:
[containers]
{% for key in hostvars %}
{{ key }} ansible_host={{ hostvars[key]['ansible_default_ipv4']['address'] }}
{% endfor %}
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment