Add hostname resolution to deploy host
This addresses an issue with delegation to containers noticed as a result of https://github.com/ansible/ansible/issues/72776 which causes the container host to be accessed by its hostname. Where a separate deploy host is used, up to now this has not had its hosts file modified. This patch applies the same /etc/hosts entries to the deploy host which are used elsewhere. Change-Id: I82b48ba5cfe6e533426e7098c455b729084b2d51
This commit is contained in:
@@ -34,10 +34,12 @@ openstack_host_sysstat_statistics_hour: 23
|
||||
# Options are 'present' and 'latest'
|
||||
openstack_hosts_package_state: "latest"
|
||||
|
||||
## Enable/disable /etc/hosts file management
|
||||
## Enable/disable /etc/hosts file management on OSA managed hosts
|
||||
## You should make other arrangements for name resolution
|
||||
## of OSA containers and hosts if disabling this
|
||||
## of OSA containers and hosts if disabling these
|
||||
openstack_host_manage_hosts_file: true
|
||||
## Enable/disable /etc/hosts file management on OSA deploy host
|
||||
openstack_host_manage_deploy_hosts_file: true
|
||||
|
||||
## kernel modules for specific group hosts
|
||||
openstack_host_specific_kernel_modules: []
|
||||
|
13
releasenotes/notes/deploy-hosts-file-657a385568f3df9c.yaml
Normal file
13
releasenotes/notes/deploy-hosts-file-657a385568f3df9c.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
In deployments where a separate host is used to manage the OpenStack
|
||||
Ansible configuration, the '/etc/hosts' file on that host will now include
|
||||
a section adding hostname to IP resolution for all hosts in the inventory.
|
||||
This can be enabled/disabled via 'openstack_host_manage_deploy_hosts_file'.
|
||||
issues:
|
||||
- |
|
||||
Where a single OSA deploy host is used to manage multiple deployments, some
|
||||
delegated Ansible tasks are performed using hostnames rather than IP
|
||||
addresses due to Ansible issue 72776. Hostnames such as 'infra1' will be
|
||||
ambiguous, so use of separate hosts for each deployment is recommended.
|
@@ -50,10 +50,10 @@
|
||||
# Configure host files should apply to all nodes
|
||||
- name: Configure etc hosts files
|
||||
import_tasks: openstack_update_hosts_file.yml
|
||||
when:
|
||||
- openstack_host_manage_hosts_file | bool
|
||||
tags:
|
||||
- openstack_hosts-config
|
||||
when:
|
||||
- (openstack_host_manage_hosts_file | bool) or (openstack_host_manage_deploy_hosts_file | bool)
|
||||
|
||||
- name: Remove the blacklisted packages
|
||||
package:
|
||||
|
@@ -42,3 +42,16 @@
|
||||
dest: /etc/hosts
|
||||
block: "{{ _etc_hosts_content | join('\n') }}"
|
||||
marker: "### {mark} OPENSTACK-ANSIBLE MANAGED BLOCK ###"
|
||||
when:
|
||||
- openstack_host_manage_hosts_file | bool
|
||||
|
||||
- name: Update hosts file on deploy host
|
||||
blockinfile:
|
||||
dest: /etc/hosts
|
||||
block: "{{ _etc_hosts_content | join('\n') }}"
|
||||
marker: "### {mark} OPENSTACK-ANSIBLE {{ lookup('env', 'OSA_CONFIG_DIR') }} MANAGED BLOCK ###"
|
||||
run_once: True
|
||||
delegate_to: localhost
|
||||
become: True
|
||||
when:
|
||||
- openstack_host_manage_deploy_hosts_file | bool
|
||||
|
Reference in New Issue
Block a user