blob: e1dea056a8d47b84feba09747f7c4186966b7f4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
---
title: "Dump all ansible variables"
date: 2019-10-15
description: How to dump all variables used by ansible in a task
tags:
- ansible
---
## Task to use
Here is the task to use in order to achieve that :
{{< highlight yaml >}}
- name: Dump all vars
action: template src=dumpall.j2 dest=ansible.all
{{< /highlight >}}
## Associated template
And here is the template to use with it :
{{< highlight jinja >}}
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 }}
{{< /highlight >}}
## Output
If you are running a local task, the output will be in your playbook directory. Otherwise, it will be on the target machine(s) in a `.ansible/tmp/ansible.all` file under the user your are connecting the machine(s)' with.
|