Created
February 1, 2021 17:28
-
-
Save ymartin59/0705a7803b12cfed2590aec3639e526f to your computer and use it in GitHub Desktop.
Ansible playbook to dump host environment, groups and variables
This file contains hidden or 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
# Standalone easy-to-use one-file playbook | |
# Inspired from https://coderwall.com/p/13lh6w/dump-all-variables | |
- hosts: all | |
gather_facts: yes | |
become: no | |
connection: local | |
vars: | |
debug_file: "debug_env_{{ inventory_hostname }}.log" | |
tasks: | |
- name: Dump all host variables | |
copy: | |
dest: ./{{ debug_file }} | |
content: | | |
Module Variables ("vars"): | |
-------------------------------- | |
{{ vars | to_nice_json }} | |
Environment Variables ("environment"): | |
-------------------------------- | |
{{ environment | to_nice_json }} | |
GROUP NAMES Variables ("group_names"): | |
-------------------------------- | |
{{ group_names | to_nice_json }} | |
GROUPS Variables ("groups"): | |
-------------------------------- | |
{{ groups | to_nice_json }} | |
HOST Variables ("hostvars"): | |
-------------------------------- | |
{{ hostvars | to_nice_json }} | |
- debug: | |
msg="Look at content of local file ./{{ debug_file }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment