Top "Ansible-facts" questions

Use this tag for questions regarding Ansible facts - values discovered by the setup module of Ansible or pulled from ohai/facter.

Ansible: get current target host's IP address

How do you get the current host's IP address in a role? I know you can get the list of …

ansible ansible-facts ansible-template
Where can I get a list of Ansible pre-defined variables?

I see that Ansible provide some pre-defined variables that we can use in playbooks and template files. For example, the …

ansible ansible-facts
How to get an arbitrary remote user's home directory in Ansible?

I can do that with shell using combination of getent and awk like this: getent passwd $user | awk -F: '{ …

ansible ansible-facts
Check if arrays are defined and not empty in ansible

I have the following code - set_fact: MY_HOSTNAME: "SOME VALUE" MY_SERVER: "00.00.00.00" - name: Get MY server set_…

ansible ansible-facts
How to filter gathering facts inside a playbook?

I'm working on a role that only needs to gather a single fact. Performance it's a concern and I know …

ansible ansible-facts
How to get the first element of a list from the output of setup module in Ansible?

I received the following data from the setup module: "ansible_nodename": "3d734bc2a391", "ansible_os_family": "RedHat", "ansible_pkg_…

ansible jinja2 ansible-facts ansible-template
Ansible: How to specify an array or list element fact with yaml?

When we check hostvars with: - name: Display all variables/facts known for a host debug: var=hostvars[inventory_hostname] …

ansible yaml ansible-facts
How do you change ansible_default_ipv4?

I'd like to change ansible_default_ipv4 to point to eth1 instead of eth0. Can I do this in either …

ansible ansible-facts
ansible returns with "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6))

I am running myserver in ubuntu: + sudo cat /etc/os-release NAME="Ubuntu" VERSION="16.04.6 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=…

ansible ansible-2.x ansible-inventory ansible-facts
Ansible - actions BEFORE gathering facts

Does anyone know how to do something (like wait for port / boot of the managed node) BEFORE gathering facts? I …

ansible ansible-facts