diff --git a/playbooks/roles/lxc_hosts/defaults/main.yml b/playbooks/roles/lxc_hosts/defaults/main.yml index f8c77de164..d89442eb38 100644 --- a/playbooks/roles/lxc_hosts/defaults/main.yml +++ b/playbooks/roles/lxc_hosts/defaults/main.yml @@ -81,6 +81,10 @@ lxc_cache_commands: - rm -f /usr/bin/python - ln -s /usr/bin/python2.7 /usr/bin/python +lxc_cache_resolvers: + - 'nameserver 8.8.8.8' + - 'nameserver 8.8.4.4' + lxc_cache_sshd_configuration: - { regexp: "^PermitRootLogin", line: "PermitRootLogin yes" } - { regexp: "^TCPKeepAlive", line: "TCPKeepAlive yes" } diff --git a/playbooks/roles/lxc_hosts/tasks/lxc_cache_preparation.yml b/playbooks/roles/lxc_hosts/tasks/lxc_cache_preparation.yml index 965d628b3e..0c9cc72e89 100644 --- a/playbooks/roles/lxc_hosts/tasks/lxc_cache_preparation.yml +++ b/playbooks/roles/lxc_hosts/tasks/lxc_cache_preparation.yml @@ -22,6 +22,42 @@ - lxc-cache - lxc-cache-update +- name: Update container resolvers + template: + src: lxc-resolve-base.j2 + dest: "{{ lxc_container_cache_path }}/{{ item.chroot_path }}/run/resolvconf/resolv.conf" + with_items: lxc_container_caches + tags: + - lxc-cache + - lxc-cache-update + +- name: Update container resolvconf base + template: + src: lxc-resolve-base.j2 + dest: "{{ lxc_container_cache_path }}/{{ item.chroot_path }}/etc/resolvconf/resolv.conf.d/base" + with_items: lxc_container_caches + tags: + - lxc-cache + - lxc-cache-update + +- name: Update container resolvconf tail + copy: + content: "# Null Tail" + dest: "{{ lxc_container_cache_path }}/{{ item.chroot_path }}/etc/resolvconf/resolv.conf.d/tail" + with_items: lxc_container_caches + tags: + - lxc-cache + - lxc-cache-update + +- name: Update container resolvconf original + copy: + content: "# Null original" + dest: "{{ lxc_container_cache_path }}/{{ item.chroot_path }}/etc/resolvconf/resolv.conf.d/original" + with_items: lxc_container_caches + tags: + - lxc-cache + - lxc-cache-update + # This task runs several commands against the cached image to speed up the # lxc_container_create playbook. - name: Prepare cached image diff --git a/playbooks/roles/lxc_hosts/templates/lxc-resolve-base.j2 b/playbooks/roles/lxc_hosts/templates/lxc-resolve-base.j2 new file mode 100644 index 0000000000..a1556f888e --- /dev/null +++ b/playbooks/roles/lxc_hosts/templates/lxc-resolve-base.j2 @@ -0,0 +1,3 @@ +{% for item in lxc_cache_resolvers %} +{{ item }} +{% endfor %} diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index 1a379fec65..702622cc2e 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -275,6 +275,12 @@ if [ ! -d "/etc/openstack_deploy/conf.d" ];then mkdir -p "/etc/openstack_deploy/conf.d" fi +# Ensure containers are using the same resolvers as the host +RESOLVERS=$(grep nameserver /etc/resolv.conf | awk 'NF { print "\""$0"\""}' | tr '\n' ',' | sed 's/,$//' ) +if [ ! "$(grep -Rni '^lxc_cache_resolvers' /etc/openstack_deploy/user_variables.yml)" ]; then + echo "lxc_cache_resolvers: [$RESOLVERS]" | tee -a /etc/openstack_deploy/user_variables.yml +fi + # Add tempest settings for particular use-cases if [ ${DEPLOY_OPENSTACK} == "no" ]; then for svc in cinder glance heat horizon neutron nova; do