Skip to content

Address mode - #560

Merged
afeefghannam89 merged 7 commits into
mainfrom
address_mode
Oct 21, 2026
Merged

afeefghannam89 merged 7 commits into
mainfrom
address_mode

Conversation

@afeefghannam89

@afeefghannam89 afeefghannam89 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Adds elasticstack_address_mode to the elasticstack role, so the user chooses how the Ansible roles address a host of the elasticsearch, logstash or kibana inventory group: inventory (default, as before), fqdn, hostname or ip. Each host is addressed in the mode set for it in the inventory (group_vars, host_vars) or with -e. The other hosts read it through hostvars, which has no play vars or role parameters, so a value set there stops the run instead of being ignored. To run that check in every play, the component roles import the elasticstack role without the when; the role still runs its setup once per host.

The address of every such host is picked once in roles/elasticstack/tasks/node_address.yml and kept in a table. Beats, Kibana and Logstash replace the inventory names they get from groups[...] with the entries of that table. The variable proposed in the issue, computed in the role defaults and read through hostvars, cannot work: role defaults of another host are not visible there.

ip takes the address of the network card with the default route. To reach a single host at another address, for example through a different card, its host_vars can set elasticstack_node_address, an IPv4 address or a DNS name. That address wins over the mode and is added to the certificate of Elasticsearch hosts and to the certificate a Logstash host presents to the Beats. Existing certificates get it when they are renewed.

For fqdn, hostname and ip the table needs the facts of those hosts. When they are missing, for example in a run limited with --limit, they are gathered first. With the defaults nothing is gathered, and every rendered config file and certutil call stays the same as on main. The mode of every host in the table is checked as well, a typo on a host left out with --limit would otherwise end up as ip.

The Elasticsearch nodes keep finding each other by IP, elasticsearch_seed_hosts already overrides that. The logstash role keeps creating its role and user through the IP of the CA host.

The full stack Molecule scenario now sets ip in its inventory and no longer writes /etc/hosts.

Closes #524

@afeefghannam89
afeefghannam89 merged commit a8d9e50 into main Oct 21, 2026
25 checks passed
@afeefghannam89
afeefghannam89 deleted the address_mode branch October 21, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Configurable service addressing mode (fqdn/hostname/ip)

1 participant