1
0
IaC/ansible/roles/hypervisor/tasks/libvirt_dir.yaml

36 lines
773 B
YAML
Raw Permalink Normal View History

2023-08-10 09:32:17 -04:00
---
2023-08-10 11:11:37 -04:00
- name: Create the libvirt storage directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: libvirt-qemu
group: libvirt-qemu
mode: '0775'
loop:
- /var/lib/libvirt/vhds/
2023-08-10 20:52:27 -04:00
- name: Define additional libvirt storage pools
2023-08-10 11:11:37 -04:00
community.libvirt.virt_pool:
name: "{{ item.name }}"
command: define
2023-08-10 20:52:27 -04:00
xml: "{{ lookup('template', 'dir_libvirt_pool.xml.j2') }}"
2023-08-10 11:11:37 -04:00
loop:
- name: vhds
path: /var/lib/libvirt/vhds/
2023-08-10 20:52:27 -04:00
- name: Create additional libvirt storage pools
2023-08-10 11:11:37 -04:00
community.libvirt.virt_pool:
name: "{{ item }}"
command: build
loop:
- vhds
2023-08-10 20:52:27 -04:00
- name: Start additional libvirt storage pools
2023-08-10 11:11:37 -04:00
community.libvirt.virt_pool:
name: "{{ item }}"
state: active
autostart: true
loop:
- vhds