Current situation:
I use ansible tower (a.k.a. AWX) to manage our infrastructure
Names of our hosts are human-readable names like pg-node-01, pg-node-02, ...
When I run deploy_pgcluster.yaml playbook it fails in Enable and start etcd service task because in the etcd settings like ETCD_LISTEN_CLIENT_URLS and ETCD_ADVERTISE_CLIENT_URLS hostname (value from inventory_hostname) is used instead of host's IP address
My question is next:
Can we make playbook roles to use IP-address of the hostname (from ansible_host variable from inventory for example) instead of inventory hostname (inventory_hostname variable is in use currently)
Maybe there's option like adding variable ansible_host to inventory and replacing {{ inventory_hostname }} to {{ ansible_host | default(inventory_hostname) }} in ./roles/etcd/templates/etcd.conf.j2 (or in any other place that required)
There's some example:
IP-address is used instead of hostname (etcd service is running and working)
Current situation: I use ansible tower (a.k.a. AWX) to manage our infrastructure Names of our hosts are human-readable names like
pg-node-01
,pg-node-02
, ...When I run
deploy_pgcluster.yaml
playbook it fails inEnable and start etcd service
task because in the etcd settings likeETCD_LISTEN_CLIENT_URLS
andETCD_ADVERTISE_CLIENT_URLS
hostname (value frominventory_hostname
) is used instead of host's IP addressMy question is next: Can we make playbook roles to use IP-address of the hostname (from
ansible_host
variable from inventory for example) instead of inventory hostname (inventory_hostname
variable is in use currently)Maybe there's option like adding variable
ansible_host
to inventory and replacing{{ inventory_hostname }}
to{{ ansible_host | default(inventory_hostname) }}
in./roles/etcd/templates/etcd.conf.j2
(or in any other place that required)There's some example: IP-address is used instead of hostname (etcd service is running and working)
hostname is used instead of IP-address (etcd service is stopping just after start)