You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, etcd_cluster and others expect a (private) IP as their host name in the ansible inventory as this information is used within the playbooks.
Description
An alternative would be to query the local addresses dynamically within the playbook and allow setting descriptive host names instead. This would align more closely to the classical Ansible approach.
Importance
nice to have
Proposed implementation
Proof of concept:
- name: Debughosts: etcd_clusterbecome: truegather_facts: truetasks:
- name: Extract private IPset_fact:
internal_ip: "{{ ansible_all_ipv4_addresses | ipaddr('private') | first | default('No internal IP found') }}"
- name: Show the internal IPdebug:
msg: 'Internal IP Address: {{ internal_ip }}'TASK [Show the internal IP] **************************************************************************************************************************************************ok: [10.10.1.1] => {"msg": "Internal IP Address: 10.10.1.1"}ok: [10.10.1.2] => {"msg": "Internal IP Address: 10.10.1.2"}ok: [10.10.1.3] => {"msg": "Internal IP Address: 10.10.1.3"}
In this case, the variable internal_ip could be used within the playbooks.
This logic would need to account for edge cases, e.g. when multiple private interfaces are available. In this case, an optional list variable could be added in which the respective interfaces per node can be set.
The text was updated successfully, but these errors were encountered:
I think it’s time for us to support this feature, as there have already been several requests to remove the requirement of specifying a private IP in inventory_hostname.
Please also take a look at this PR here, where a similar implementation was attempted.
Additionally, it’s important to maintain backward compatibility with the current approach, as it is used by the Autobase Console when generating the inventory JSON.
Problem
Currently,
etcd_cluster
and others expect a (private) IP as their host name in the ansible inventory as this information is used within the playbooks.Description
An alternative would be to query the local addresses dynamically within the playbook and allow setting descriptive host names instead. This would align more closely to the classical Ansible approach.
Importance
nice to have
Proposed implementation
Proof of concept:
In this case, the variable
internal_ip
could be used within the playbooks.This logic would need to account for edge cases, e.g. when multiple private interfaces are available. In this case, an optional list variable could be added in which the respective interfaces per node can be set.
The text was updated successfully, but these errors were encountered: