From f408590a63fd7659355294fc1beed26150f486d0 Mon Sep 17 00:00:00 2001 From: mg Date: Tue, 8 Jun 2021 07:48:24 +0200 Subject: [PATCH] qemu_guest_agent als rolle (#110) qemu_guest_agent als rolle Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/110 Co-Authored-By: mg Co-Committed-By: mg --- playbooks/1_bootstrap.yml | 7 ++----- roles/mgrote.qemu_guest_agent/README.md | 9 +++++++++ roles/mgrote.qemu_guest_agent/tasks/main.yml | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 roles/mgrote.qemu_guest_agent/README.md create mode 100644 roles/mgrote.qemu_guest_agent/tasks/main.yml diff --git a/playbooks/1_bootstrap.yml b/playbooks/1_bootstrap.yml index 827fb6e8..3b774f21 100644 --- a/playbooks/1_bootstrap.yml +++ b/playbooks/1_bootstrap.yml @@ -6,18 +6,15 @@ - { role: robertdebock.bootstrap, tags: "bootstrap", become: yes} - { role: ryandaniels.create_users, tags: "user", become: yes} - { role: mgrote.r8152_kernel_module } + - { role: mgrote.qemu_guest_agent } post_tasks: - - name: reboot für qemu-guest-agent (dauert bis zu 2min!) - become: true - reboot: - reboot_timeout: 120 - name: Change user password become: true user: name: mg update_password: always password: "{{ lookup('keepass', 'mg_linux_password_hash', 'password') }}" - + vars: ### reobertdebock.bootstrap bootstrap_user: mg diff --git a/roles/mgrote.qemu_guest_agent/README.md b/roles/mgrote.qemu_guest_agent/README.md new file mode 100644 index 00000000..aded17db --- /dev/null +++ b/roles/mgrote.qemu_guest_agent/README.md @@ -0,0 +1,9 @@ +## mgrote.qemu_guest_agent + +### Beschreibung +Installiert den qemu-guest-agent und startet die VM danach neu. +Wird nur in VMs ausgeführt. + +### Funktioniert auf +- [x] Ubuntu (>=18.04) +- [x] Debian diff --git a/roles/mgrote.qemu_guest_agent/tasks/main.yml b/roles/mgrote.qemu_guest_agent/tasks/main.yml new file mode 100644 index 00000000..43370427 --- /dev/null +++ b/roles/mgrote.qemu_guest_agent/tasks/main.yml @@ -0,0 +1,14 @@ +--- + - name: install packages + become: yes + ansible.builtin.package: + 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