libvirt and firewall additions

This commit is contained in:
2022-09-05 15:28:28 +12:00
parent 21679647c6
commit 140749e34c
9 changed files with 129 additions and 53 deletions

View File

@ -23,28 +23,56 @@
state: started
enabled: yes
- name: define vm network
- name: define vm cluster network
libvirt_network_name: "{{ libvirt_cluster_network_name }}"
libvirt_network_domain: "{{ libvirt_cluster_network_name }}"
community.libvirt.virt_net:
name: "{{ libvirt_vm_network_name }}"
name: "{{ libvirt_cluster_network_name }}"
command: define
xml: '{{ lookup("template", "network.xml.j2") }}'
- name: build vm network
- name: build vm cluster network
community.libvirt.virt_net:
name: "{{ libvirt_vm_network_name }}"
name: "{{ libvirt_cluster_network_name }}"
command: build
- name: start vm network
- name: start vm cluster network
community.libvirt.virt_net:
name: "{{ libvirt_vm_network_name }}"
name: "{{ libvirt_cluster_network_name }}"
state: active
autostart: true
- name: remove default libvirt network
community.libvirt.virt_net:
name: default
state: absent
- name: create libvirt zfs dataset
community.general.zfs:
name: "{{ libvirt_zfs_pool_path }}"
state: present
extra_zfs_properties:
- canmount: off
- mountpoint: none
- compression: off
- primarycache: metadata
- secondarycache: none
- reservation: none
- refreservation: none
- dedup: off
- encryption: off
- volmode: dev
- devices: off
- atime: off
- name: define zfs storage pool
libvirt_pool_type: zfs
libvirt_pool_name: "{{ libvirt_zfs_pool_name }}"
libvirt_pool_path: "{{ libvirt_zfs_pool_path }}"
community.libvirt.virt_pool:
name: "{{ libvirt_zfs_pool_name }}"
command: define
xml: '{{ lookup("template", "zfs.xml.j2") }}'
xml: '{{ lookup("template", "pool.xml.j2") }}'
- name: build zfs storage pool
community.libvirt.virt_pool:
@ -57,11 +85,23 @@
state: active
autostart: true
- name: create iso storage dir
become: true
ansible.builtin.file:
path: "{{ libvirt_iso_pool_path }}"
state: directory
owner: root
group: libvirt
mode: 0775
- name: define iso storage pool
libvirt_pool_type: dir
libvirt_pool_name: "{{ libvirt_iso_pool_name }}"
libvirt_pool_path: "{{ libvirt_iso_pool_path }}"
community.libvirt.virt_pool:
name: "{{ libvirt_iso_pool_name }}"
command: define
xml: '{{ lookup("template", "iso.xml.j2") }}'
xml: '{{ lookup("template", "pool.xml.j2") }}'
- name: build iso storage pool
community.libvirt.virt_pool:
@ -74,11 +114,23 @@
state: active
autostart: true
- name: create qcow storage dir
become: true
ansible.builtin.file:
path: "{{ libvirt_qcow_pool_path }}"
state: directory
owner: root
group: libvirt
mode: 0775
- name: define qcow storage pool
libvirt_pool_type: dir
libvirt_pool_name: "{{ libvirt_qcow_pool_name }}"
libvirt_pool_path: "{{ libvirt_qcow_pool_path }}"
community.libvirt.virt_pool:
name: "{{ libvirt_qcow_pool_name }}"
command: define
xml: '{{ lookup("template", "qcow.xml.j2") }}'
xml: '{{ lookup("template", "pool.xml.j2") }}'
- name: build qcow storage pool
community.libvirt.virt_pool: