Ansible hostvars: Difference between revisions

From Freephile Wiki
m tagged
No edit summary
 
Line 1: Line 1:
<code>ansible -m debug -a "var=hostvars['wiki.example.net']" localhost </code> will give you all the defined 'variables' associated with a given host
<code>ansible -m debug -a "var=hostvars['wiki.example.net']" localhost </code> will give you all the defined 'variables' associated with a given host
<code>ansible localhost -m ansible.builtin.debug -a "var=hostvars['localhost']" -c local</code>
== Setup module ==
<code>ansible localhost -m setup -a 'gather_subset=!all'</code>


Many of these may be sensitive, so they aren't shown here, but give it a try.
Many of these may be sensitive, so they aren't shown here, but give it a try.
[[Category:Ansible]]
[[Category:Ansible]]

Latest revision as of 07:47, 25 August 2025

ansible -m debug -a "var=hostvars['wiki.example.net']" localhost will give you all the defined 'variables' associated with a given host


ansible localhost -m ansible.builtin.debug -a "var=hostvars['localhost']" -c local


Setup module

ansible localhost -m setup -a 'gather_subset=!all'


Many of these may be sensitive, so they aren't shown here, but give it a try.