Add libvirt role
This commit is contained in:
parent
403b65f812
commit
c4af7178b2
10
system/extra/libvirt/meta/argument_specs.yml
Normal file
10
system/extra/libvirt/meta/argument_specs.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
argument_specs:
|
||||
main:
|
||||
options:
|
||||
system_extra_libvirt_user_name:
|
||||
type: "str"
|
||||
required: true
|
||||
system_extra_libvirt_install_zfs_driver:
|
||||
type: "bool"
|
||||
required: true
|
45
system/extra/libvirt/tasks/main.yml
Normal file
45
system/extra/libvirt/tasks/main.yml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: "install libvirt"
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- "dnsmasq"
|
||||
- "libvirt-daemon-system"
|
||||
- "netcat"
|
||||
- "qemu-system"
|
||||
install_recommends: false
|
||||
register: system_extra_libvirt_install
|
||||
|
||||
- name: "install zfs storage driver for libvirt"
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- "libvirt-daemon-driver-storage-zfs"
|
||||
when:
|
||||
system_extra_libvirt_install_zfs_driver
|
||||
register: system_extra_libvirt_zfs_driver
|
||||
|
||||
- name: "enable libvirtd"
|
||||
ansible.builtin.systemd:
|
||||
name: "libvirtd"
|
||||
enabled: true
|
||||
|
||||
- name: "start libvirtd"
|
||||
ansible.builtin.systemd:
|
||||
name: "libvirtd"
|
||||
state: "started"
|
||||
register: system_extra_libvirt_start
|
||||
|
||||
- name: "restart libvirtd"
|
||||
ansible.builtin.systemd:
|
||||
name: "libvirtd"
|
||||
state: "restarted"
|
||||
when:
|
||||
(system_extra_libvirt_install.changed or
|
||||
(system_extra_libvirt_zfs_driver is defined and
|
||||
system_extra_libvirt_zfs_driver.changed)) and
|
||||
not system_extra_libvirt_start.changed
|
||||
|
||||
- name: "add {{ system_extra_libvirt_user_name }} to group \"libvirt\""
|
||||
ansible.builtin.user:
|
||||
name: "{{ system_extra_libvirt_user_name }}"
|
||||
groups: "libvirt"
|
||||
append: true
|
Loading…
Reference in New Issue
Block a user