Set undercloud hostname from ansible variables
This sets the undercloud hostname from ansible variables instead of having to call hostnamectl. This also sets a domain to the hostname if needed. The hostname is set with one of the following cases, in this order of precedence * When we have undercloud_cloud_domain defined, we use that for the FQDN * When we have an FQDN we use that. * If not, we default to <hostname>.tripleodomain.example.com Note that these are only used if undercloud_undercloud_hostname wasn't provided. Depends-On: I7705744cab62f432e2e09bf1ee88bba809609cda Change-Id: I649d6cb87458f2bc9623c84830a45bdcf54432d4 Closes-Bug: #1801769
This commit is contained in:
parent
bc964e7378
commit
d78d8f5e05
|
@ -21,12 +21,29 @@
|
|||
when:
|
||||
- not release in ['newton','ocata','pike','queens']
|
||||
- containerized_undercloud|bool
|
||||
- undercloud_undercloud_hostname is not defined
|
||||
block:
|
||||
- name: Get the hostname info
|
||||
command: hostnamectl --static
|
||||
register: hostnamectl_result
|
||||
- name: set fact for undercloud_fqdn override when undercloud_cloud_domain was provided
|
||||
set_fact:
|
||||
undercloud_fqdn: "{{ ansible_hostname }}.{{ undercloud_cloud_domain }}"
|
||||
when:
|
||||
- undercloud_cloud_domain is defined
|
||||
|
||||
- name: set fact for undercloud_fqdn override when we have a domain
|
||||
set_fact:
|
||||
undercloud_fqdn: "{{ ansible_fqdn }}"
|
||||
when:
|
||||
- ansible_domain|default("") != ""
|
||||
- undercloud_cloud_domain is not defined
|
||||
|
||||
- name: set fact for undercloud_fqdn override when we don't have a domain
|
||||
set_fact:
|
||||
undercloud_fqdn: "{{ ansible_hostname }}.tripleodomain.example.com"
|
||||
when:
|
||||
- ansible_domain|default("") == ""
|
||||
- undercloud_cloud_domain is not defined
|
||||
|
||||
- name: Set fact for undercloud_hostname override
|
||||
set_fact:
|
||||
cacheable: true
|
||||
undercloud_undercloud_hostname: "{{ hostnamectl_result.stdout }}"
|
||||
undercloud_undercloud_hostname: "{{ undercloud_fqdn }}"
|
||||
|
|
Loading…
Reference in New Issue