imfreedom/ansible

ff6b408e3bcf
Parents 6268baf0fdae
Children a8fd79d9daea
Add a step to add users to the libvirt group
--- a/inventories/pidgin/hosts.yaml Sat Sep 18 18:59:37 2021 -0500
+++ b/inventories/pidgin/hosts.yaml Sat Sep 18 19:09:36 2021 -0500
@@ -59,6 +59,8 @@
hosts:
grim-chariot:
ansible_host: chariot
+ libvirt_group_users:
+ - grim
teamcity_simple_agents:
hosts:
grim-beastie:
--- a/roles/libvirt/tasks/debian.yaml Sat Sep 18 18:59:37 2021 -0500
+++ b/roles/libvirt/tasks/debian.yaml Sat Sep 18 19:09:36 2021 -0500
@@ -10,4 +10,6 @@
force_apt_get: true
- name: setup default network
include_tasks: "network.yaml"
+- name: configure users
+ include_tasks: "user.yaml"
--- a/roles/libvirt/tasks/network.yaml Sat Sep 18 18:59:37 2021 -0500
+++ b/roles/libvirt/tasks/network.yaml Sat Sep 18 19:09:36 2021 -0500
@@ -8,6 +8,7 @@
when: create_network|bool
- name: enable default network
shell: virsh net-start default # noqa 301 305
+ ignore_errors: true
- name: set default network to autostart
shell: virsh net-autostart default # noqa 301 305
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/libvirt/tasks/user.yaml Sat Sep 18 19:09:36 2021 -0500
@@ -0,0 +1,7 @@
+---
+- name: add users to libvirt group
+ user:
+ name: "{{ item }}"
+ groups: libvirt
+ loop: "{{ libvirt_group_users }}"
+