Apply Zun configuration for Docker based on inventory

If docker_configure_for_zun is set to true, then Zun-specific
configuration for Docker is applied to all nodes. It should only be
applied based on the relevant inventory groups. In some cases this can
cause Docker to fail to start. See
https://storyboard.openstack.org/#!/story/2008544 for details.

This change applies the configuration based on the zun-compute and
zun-cni-daemon groups. It also modifies the expression to not assume
that these groups exist in the inventory.

Change-Id: I0141abf0dd83e3a567ea6dcca945f86db129becf
Closes-Bug: #1914378
Story: 2008544
Task: 41645
Co-Authored-By: Buddhika Sanjeewa <bsanjeewa@kln.ac.lk>
This commit is contained in:
Mark Goddard 2021-02-03 09:15:44 +00:00
parent cddb9f2152
commit 5c39810de2
4 changed files with 14 additions and 6 deletions

View File

@ -6,5 +6,6 @@
- import_tasks: post-install.yml
- include_tasks: configure-containerd-for-zun.yml
when: containerd_configure_for_zun|bool and
inventory_hostname in groups['zun-cni-daemon']
when:
- containerd_configure_for_zun|bool
- "'zun-cni-daemon' in group_names"

View File

@ -66,6 +66,7 @@
docker_config: "{{ docker_config | combine(docker_zun_config) }}"
when:
- docker_configure_for_zun | bool
- "'zun-compute' in group_names"
- name: Warn about deprecations
debug:
@ -136,7 +137,7 @@
state: absent
when:
- not docker_custom_option
- not docker_configure_for_zun | bool
- not docker_configure_for_zun | bool or 'zun-compute' not in group_names
- not docker_http_proxy
- not docker_https_proxy
- not docker_no_proxy
@ -149,7 +150,7 @@
recurse: yes
when: >
docker_custom_option | length > 0 or
docker_configure_for_zun | bool or
(docker_configure_for_zun | bool and 'zun-compute' in group_names) or
docker_http_proxy | length > 0 or
docker_https_proxy | length > 0 or
docker_no_proxy | length > 0
@ -161,7 +162,7 @@
dest: /etc/systemd/system/docker.service.d/kolla.conf
when: >
docker_custom_option | length > 0 or
docker_configure_for_zun | bool or
(docker_configure_for_zun | bool and 'zun-compute' in group_names) or
docker_http_proxy | length > 0 or
docker_https_proxy | length > 0 or
docker_no_proxy | length > 0

View File

@ -10,4 +10,4 @@ Environment="NO_PROXY={{ docker_no_proxy }}"
{% endif %}
ExecStart=
# ExecStart commandline copied from 'docker-ce' package. Same on CentOS/Debian/Ubuntu systems.
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock{% if docker_custom_option %} {{ docker_custom_option }}{% endif %}{% if docker_configure_for_zun|bool %} {{ docker_zun_options }}{% endif %}
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock{% if docker_custom_option %} {{ docker_custom_option }}{% endif %}{% if docker_configure_for_zun|bool and 'zun-compute' in group_names %} {{ docker_zun_options }}{% endif %}

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue with ``kolla-ansible bootstrap-servers`` if Zun is enabled
where Zun-specific configuration for Docker was applied to all nodes.
`LP#1914378 <https://bugs.launchpad.net/kolla-ansible/+bug/1914378>`__