Created
February 9, 2016 21:25
-
-
Save sivel/594035c77510dd633e41 to your computer and use it in GitHub Desktop.
Create Ansible host vars dump for all hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
{% for host in groups.all %} | |
"{{ host }}": {{ hostvars[host]|to_json }}{{ ',' if not loop.last else '' }} | |
{% endfor %} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
gather_facts: true | |
tasks: | |
- name: Create hostvars dump | |
copy: | |
content: "{{ lookup('template', 'dump.j2')|from_json|to_nice_json }}" | |
dest: ./dump.json | |
run_once: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment