From c4c9bc32b6b91f205dec45143044e4186091265d Mon Sep 17 00:00:00 2001 From: Slash Date: Sat, 28 May 2016 16:50:27 +0200 Subject: [PATCH] Moved lxc_guest restart on config edit from handlers to tasks. --- roles/lxc_guest/handlers/main.yaml | 5 ----- roles/lxc_guest/tasks/main.yaml | 8 ++++++-- 2 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 roles/lxc_guest/handlers/main.yaml diff --git a/roles/lxc_guest/handlers/main.yaml b/roles/lxc_guest/handlers/main.yaml deleted file mode 100644 index 29f4d13..0000000 --- a/roles/lxc_guest/handlers/main.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- name: restart container - lxc_container: - name: "{{ vm_name }}" - state: restarted - when: "auto_start == true" diff --git a/roles/lxc_guest/tasks/main.yaml b/roles/lxc_guest/tasks/main.yaml index 004e18b..ae2753d 100644 --- a/roles/lxc_guest/tasks/main.yaml +++ b/roles/lxc_guest/tasks/main.yaml @@ -30,8 +30,12 @@ - block: - name: update container config template: src=config.j2 dest="/var/lib/lxc/{{ vm_name }}/config" - notify: - - restart container + register: container_config_update + - name: restart container + lxc_container: + name: "{{ vm_name }}" + state: restarted + when: container_config_update.changed - name: set container running state lxc_container: name: "{{ vm_name }}"