When Hostname Ansible - Thestye
https://thestye.com/bash/when-hostname-ansibleIn this article let’s discuss about When hostname ansible. Let’s go through the following methods without any delay. Method 1: # Use Special Variable inventory_hostname when: inventory_hostname == 'your_inventory_name' If you are facing any issues with the above approach then try the alternative that is given below.
Special Variables — Ansible Documentation
docs.ansible.com › ansible › latestDec 21, 2021 · A dictionary/map with all the hosts in inventory and variables assigned to them. inventory_hostname. The inventory name for the ‘current’ host being iterated over in the play. inventory_hostname_short. The short version of inventory_hostname. inventory_dir. The directory of the inventory source in which the inventory_hostname was first ...