From e3b3ee0eec1ae8d1061de02d0525b14ef7c92e76 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sat, 1 Jun 2024 23:30:09 +0200 Subject: [PATCH] common: Add vm tweaks --- group_vars/all.yaml | 2 ++ group_vars/music.yaml | 2 ++ roles/common/defaults/main.yaml | 1 + roles/common/tasks/main.yaml | 4 ++++ roles/common/tasks/vm.yaml | 15 +++++++++++++++ 5 files changed, 24 insertions(+) create mode 100644 roles/common/tasks/vm.yaml diff --git a/group_vars/all.yaml b/group_vars/all.yaml index a8a40cc..6314820 100644 --- a/group_vars/all.yaml +++ b/group_vars/all.yaml @@ -1,3 +1,5 @@ +is_vm: true + ansible_user: root ansible_python_interpreter: auto_silent notify_email: bestuur@bitlair.nl diff --git a/group_vars/music.yaml b/group_vars/music.yaml index 7106ebf..c9282d6 100644 --- a/group_vars/music.yaml +++ b/group_vars/music.yaml @@ -1,3 +1,5 @@ +is_vm: false + music_domain: music.bitlair.nl acme_san_domains: - [ music.bitlair.nl ] diff --git a/roles/common/defaults/main.yaml b/roles/common/defaults/main.yaml index 350a20e..000579f 100644 --- a/roles/common/defaults/main.yaml +++ b/roles/common/defaults/main.yaml @@ -1,4 +1,5 @@ ssh_port: "22" +is_vm: false unattended_upgrades_auto_reboot_time: "04:00" unattended_upgrades_extra_origin_patterns: [] trusted_ranges: diff --git a/roles/common/tasks/main.yaml b/roles/common/tasks/main.yaml index 79c1612..6e437c8 100644 --- a/roles/common/tasks/main.yaml +++ b/roles/common/tasks/main.yaml @@ -18,6 +18,10 @@ - tags: node-exporter import_tasks: node-exporter.yaml +- tags: vm + import_tasks: node-exporter.yaml + when: is_vm + - name: Remove Vim apt: name: vim diff --git a/roles/common/tasks/vm.yaml b/roles/common/tasks/vm.yaml new file mode 100644 index 0000000..fa34a4e --- /dev/null +++ b/roles/common/tasks/vm.yaml @@ -0,0 +1,15 @@ +--- +- name: Install guest agent + apt: + name: qemu-guest-agent + +- name: Serial Console + lineinfile: + path: /etc/default/grub + regexp: ^GRUB_CMDLINE_LINUX_DEFAULT + line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet console=ttyS0,115200n1 console=tty0"' + notify: + - update grub + - reboot + +- meta: flush_handlers