From 58cb2946e2220a99786cc538bf55acaa17a4631e Mon Sep 17 00:00:00 2001 From: mg Date: Tue, 8 Jun 2021 08:15:31 +0200 Subject: [PATCH] reboot als handler (#111) reboot als handler Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/111 Co-Authored-By: mg Co-Committed-By: mg --- roles/mgrote.qemu_guest_agent/handlers/main.yml | 5 +++++ roles/mgrote.qemu_guest_agent/tasks/main.yml | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 roles/mgrote.qemu_guest_agent/handlers/main.yml diff --git a/roles/mgrote.qemu_guest_agent/handlers/main.yml b/roles/mgrote.qemu_guest_agent/handlers/main.yml new file mode 100644 index 00000000..1ac62ba0 --- /dev/null +++ b/roles/mgrote.qemu_guest_agent/handlers/main.yml @@ -0,0 +1,5 @@ +--- + - name: reboot + become: true + reboot: + reboot_timeout: 120 diff --git a/roles/mgrote.qemu_guest_agent/tasks/main.yml b/roles/mgrote.qemu_guest_agent/tasks/main.yml index 43370427..f0e68c0d 100644 --- a/roles/mgrote.qemu_guest_agent/tasks/main.yml +++ b/roles/mgrote.qemu_guest_agent/tasks/main.yml @@ -5,10 +5,4 @@ name: qemu-guest-agent state: present when: ansible_virtualization_role == 'guest' - register: qemu_installed - - - name: reboot (dauert bis zu 2min!) - become: true - reboot: - reboot_timeout: 120 - when: qemu_installed.changed == true + notify: reboot