We use ansible 'facts' to print environment variables of remote client.
‘ansible_env’ will garther all environment variables. Make sure 'gather_facts' is enabled/true.
Below playbook will print the env variable on client:
- hosts: all
gather_facts: true
tasks:
- name: Printing all the environment variables in client
debug:
msg: "{{ ansible_env }}"
gather_facts: true
tasks:
- name: Printing all the environment variables in client
debug:
msg: "{{ ansible_env }}"
Sample Output:
No comments:
Post a Comment