Created
November 24, 2015 19:31
-
-
Save strootman/cb5162671d94bfdea9a7 to your computer and use it in GitHub Desktop.
A means of determining which inventory groups are associated with a given host
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
{{inventory_hostname}} | |
======================== | |
{% for group in group_names %} | |
{{ group }} | |
{% 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
--- | |
- name: Get all groups associate with a host | |
hosts: all | |
gather_facts: false | |
tasks: | |
- name: Create file | |
local_action: template src=groups_for_hosts.txt.j2 dest="/tmp/groups_for_host_{{inventory_hostname}}.txt" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment