Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using IP address instead of hostname in Ansible AWX/Tower #question #612

Open
silverbullet0201 opened this issue Mar 28, 2024 · 1 comment
Labels
question Further information is requested

Comments

@silverbullet0201
Copy link

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)

ETCD_LISTEN_CLIENT_URLS="http://1.2.3.4:2379,http://127.0.0.1:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://1.2.3.4:2379"
# ...

hostname is used instead of IP-address (etcd service is stopping just after start)

ETCD_LISTEN_CLIENT_URLS="http://pg-node-01:2379,http://127.0.0.1:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://pg-node-01:2379"
# ...
@silverbullet0201 silverbullet0201 changed the title Using #question Using IP address instead of hostname in Ansible AWX/Tower #question Mar 28, 2024
@vitabaks
Copy link
Owner

vitabaks commented Mar 28, 2024

Yes, it must be done. It is not the first request on the topic inventory_hostname.

Currently, it is required to specify IP addresses.

@vitabaks vitabaks added the question Further information is requested label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants