Allow disabling container restarts

Allow a deployer to disable container restarts by setting
``lxc_container_allow_restarts`` to ``false``.

The tasks in common-tasks/os-lxc-container-setup.yml change some
container options that require a restart to be effective. If these
change during an upgrade this can cause uncoordinated LXC container
restarts of galera or rabbitmq containers.

This is a complement to the same option already present in the
lxc_container_create role.

Change-Id: Ib9b9daf816b0f62522997d2b0e66b6a5acd9a645
This commit is contained in:
Gaudenz Steinlin 2017-12-01 21:10:39 +01:00
parent 1ab7a86b39
commit 35d1415a22
2 changed files with 16 additions and 0 deletions

View File

@ -113,6 +113,7 @@
until: container_stop | success
retries: 3
when:
- lxc_container_allow_restarts | default(True) | bool
- not is_metal | bool
- (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed)
- _lxc_container_state.stdout.find('RUNNING') != -1

View File

@ -0,0 +1,15 @@
---
features:
- A new variable has been added to allow a deployer to control
the restart of containers from common-tasks/os-lxc-container-setup.yml.
This new option is ``lxc_container_allow_restarts`` and has a
default of ``true``. If a deployer wishes to disable the
auto-restart functionality they can set this value to ``false``
and automatic container restarts will be disabled.
This is a complement to the same option already present in the
lxc_container_create role.
This option is useful to avoid uncoordinated restarts of galera
or rabbitmq containers if the LXC container configuration changes
in a way that requires a restart.