From 1da9fb16cf62d19ab75bf07d046f9b8f30702095 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Fri, 16 Aug 2024 00:47:19 +0200 Subject: [PATCH] Fix and enable virtual role --- localhost.yml | 2 +- roles/virtual/tasks/libvirt.yml | 30 +++++++++++++++++----- roles/virtual/tasks/looking-glass-arch.yml | 5 ++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/localhost.yml b/localhost.yml index 7f60550..8e6a805 100644 --- a/localhost.yml +++ b/localhost.yml @@ -14,10 +14,10 @@ - laptop - backup - gaming + - virtual # - ego # - dev-flutter -# - virtual # - terraform - postinstall vars: diff --git a/roles/virtual/tasks/libvirt.yml b/roles/virtual/tasks/libvirt.yml index c24fd2d..fad241c 100644 --- a/roles/virtual/tasks/libvirt.yml +++ b/roles/virtual/tasks/libvirt.yml @@ -1,5 +1,5 @@ --- -- name: install libvirt packages [Ubuntu] +- name: "[Ubuntu] install libvirt packages" when: ansible_distribution == "Ubuntu" become: yes apt: @@ -12,26 +12,44 @@ - libvirt-clients - bridge-utils -- name: install libvirt packages [Arch] +- name: "[Arch] install libvirt packages" become: yes community.general.pacman: name: - - kvm + - dnsmasq - qemu-full - libvirt - virt-manager - virt-viewer -- name: ensure that your user is added to the group libvirtd +- name: "[Ubuntu] ensure that your user is added to the group libvirtd" + when: ansible_distribution == "Ubuntu" become: yes user: name: "{{ ansible_user_id }}" append: yes groups: libvirt, kvm -- name: enable default network +- name: "[Arch] ensure that your user is added to the group libvirtd" + when: ansible_distribution == "Ubuntu" + become: yes + user: + name: "{{ ansible_user_id }}" + append: yes + groups: + - libvirt-qemu + - qemu + +- name: "[All] Enable service" + become: yes + ansible.builtin.systemd: + name: libvirtd + state: started + enabled: yes + +- name: "[All] enable default network" become: yes shell: - cmd: + cmd: | virsh net-autostart default virsh net-start default diff --git a/roles/virtual/tasks/looking-glass-arch.yml b/roles/virtual/tasks/looking-glass-arch.yml index 96c551e..427a6b1 100644 --- a/roles/virtual/tasks/looking-glass-arch.yml +++ b/roles/virtual/tasks/looking-glass-arch.yml @@ -1,6 +1,5 @@ --- -- name: install IntelliJ [AUR] +- name: "[Arch] install looking-glass" shell: cmd: - yay -S --needed --noconfirm \ - intellij-idea-ultimate-edition \ No newline at end of file + yay -S --needed --noconfirm looking-glass