Permalink
Browse files

Allow a deployer to disable container restarts

This changes allows a deployer to disable a container restart
by setting the option ``lxc_container_allow_restarts`` to ``false``.

Change-Id: I2c681d7e0681f8586286dc9f371d7b5e231bda68
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
  • Loading branch information...
1 parent fcd409f commit bc0046b751a0c554903263ad6781485013c2b51d @cloudnull cloudnull committed with jimmymccrory Jul 20, 2016
@@ -80,3 +80,5 @@ lxc_container_interface: |
iface {{ item.value.interface }} inet manual
{% endif %}
### end generated network for [ {{ item.value.interface }} ] ###
+
+lxc_container_allow_restarts: true
@@ -17,6 +17,7 @@
lxc_container:
name: "{{ inventory_hostname }}"
state: "stopped"
+ when: lxc_container_allow_restarts | bool
notify:
- Start Container
delegate_to: "{{ physical_host }}"
@@ -76,14 +76,25 @@
ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket || true
ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount || true
echo -e '{{ lxc_container_default_interfaces }}' | tee /etc/network/interfaces
- container_config:
+ delegate_to: "{{ physical_host }}"
+ tags:
+ - lxc-container-create
+
+- name: Write container config
+ lineinfile:
+ dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
+ line: "{{ item }}"
+ backup: "true"
+ with_items:
- "lxc.autodev=1"
- "lxc.pts=1024"
- "lxc.kmsg=0"
- "lxc.hook.autodev=/var/lib/lxc/{{ inventory_hostname }}/autodev"
delegate_to: "{{ physical_host }}"
+ notify:
+ - Lxc container restart
tags:
- - lxc-container-create
+ - lxc-container-config
- name: Load container service mounts and profile
lxc_container:
@@ -0,0 +1,8 @@
+---
+features:
+ - A new variable has been added to allow a deployer to control
+ the restart of containers via the handler. 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 that are not absolutely required will be disabled.

0 comments on commit bc0046b

Please sign in to comment.