Simplify libvirt role configuration
This commit is contained in:
@@ -1,40 +1,13 @@
|
|||||||
- name: Install QEMU/KVM
|
- name: Install QEMU/KVM and libvirt
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: qemu-kvm
|
name: ["qemu-system", "libvirt-clients", "libvirt-daemon-system"]
|
||||||
state: present
|
install_recommends: false
|
||||||
|
|
||||||
- name: Install Libvirt
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: ["libvirt-clients", "libvirt-daemon-system"]
|
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add users to libvirt group
|
- name: Add users to libvirt group
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
groups: libvirt
|
groups: libvirt
|
||||||
append: yes
|
append: true
|
||||||
with_items: "{{ libvirt_users }}"
|
with_items: "{{ libvirt_users }}"
|
||||||
when: libvirt_users is defined
|
when: libvirt_users is defined
|
||||||
|
|
||||||
- name: Check for NODOWNLOAD file
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: /var/lib/libvirt/images/NODOWNLOAD
|
|
||||||
register: NODOWNLOAD
|
|
||||||
|
|
||||||
- name: Download GNU/Linux ISOs
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "{{ item.url }}"
|
|
||||||
dest: /var/lib/libvirt/images
|
|
||||||
checksum: "{{ item.hash }}"
|
|
||||||
owner: libvirt-qemu
|
|
||||||
group: libvirt-qemu
|
|
||||||
loop: "{{ libvirt_isos }}"
|
|
||||||
register: download_isos
|
|
||||||
when: libvirt_isos is defined and NODOWNLOAD.stat.exists == false
|
|
||||||
|
|
||||||
# Prevent downloaded ISOs from being rehashed every run
|
|
||||||
- name: Create NODOWNLOAD file
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /var/lib/libvirt/images/NODOWNLOAD
|
|
||||||
state: touch
|
|
||||||
when: download_isos.changed
|
|
||||||
|
|||||||
Reference in New Issue
Block a user