configure the undercloud to use nameservers from virthost

When using libvirt, use nameserver derived from the
virthost /etc/resolv.conf file. This should work in
public/private networks.

Depends-On: I1e8e9d26469ac0034819c94029360379e2c6140c
Change-Id: Id35120df9dd5331e64a06ee886ccd64edf8834ec
This commit is contained in:
Wes Hayutin 2017-06-20 13:09:40 -04:00 committed by Attila Darazs
parent 46642b0b56
commit 45d316afff
3 changed files with 21 additions and 1 deletions

View File

@ -52,3 +52,7 @@ novajoin_connect_timeout: 5
novajoin_read_timeout: 20
libvirt_default_network_address: 192.168.122.1
# only to be used in libvirt deployments, see environment config for details
nameserver_from_virthost: false
virthost_nameservers: []

View File

@ -1,5 +1,17 @@
# Creat the scripts that will be used to deploy the undercloud
# environment.
- name: Check the dns information provided by the virthost
shell: >
gawk '/^nameserver +/ { print $2 }' /etc/resolv.conf
delegate_to: virthost
register: virthost_nameservers_output
when: nameserver_from_virthost|bool
- name: set name server facts
set_fact:
virthost_nameservers: "{{ virthost_nameservers_output.stdout_lines }}"
when: nameserver_from_virthost|bool
- name: Create undercloud configuration
template:
src: "{{ undercloud_config_file }}"

View File

@ -74,7 +74,11 @@ undercloud_admin_host = {{undercloud_undercloud_admin_host|default(
# Nameserver for the Undercloud node.
# (string value)
{% if undercloud_undercloud_nameservers is string %}
{% if virthost_nameservers is string %}
undercloud_nameservers = {{ virthost_nameservers }}
{% elif virthost_nameservers is sequence and virthost_nameservers|length > 0 %}
undercloud_nameservers = {{ virthost_nameservers|join(',') }}
{% elif undercloud_undercloud_nameservers is string %}
undercloud_nameservers = {{ undercloud_undercloud_nameservers }}
{% elif undercloud_undercloud_nameservers is sequence %}
undercloud_nameservers = {{ undercloud_undercloud_nameservers|join(',') }}