mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
7
roles/libvirt_host/defaults/main.yml
Normal file
7
roles/libvirt_host/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
libvirt_group: 'libvirt'
|
||||
libvirt_listen_tcp: False
|
||||
libvirt_listen_tls: False
|
||||
libvirt_qemu_save_format: 'lzop'
|
||||
libvirt_parallel_suspend: '2'
|
||||
...
|
2
roles/libvirt_host/files/libvirt-guests-timeout.conf
Normal file
2
roles/libvirt_host/files/libvirt-guests-timeout.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
TimeoutStopSec=0
|
6
roles/libvirt_host/handlers/main.yml
Normal file
6
roles/libvirt_host/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- include: ../common/handlers/main.yml
|
||||
|
||||
- name: restart libvirtd
|
||||
service: name=libvirtd state=restarted enabled=yes
|
||||
...
|
5
roles/libvirt_host/meta/main.yml
Normal file
5
roles/libvirt_host/meta/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- { role: common }
|
||||
- { role: backup }
|
||||
...
|
60
roles/libvirt_host/tasks/main.yml
Normal file
60
roles/libvirt_host/tasks/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
|
||||
- name: Install repositories
|
||||
yum: name=centos-release-qemu-ev state=latest
|
||||
|
||||
- name: Install libvirt tools
|
||||
yum:
|
||||
name:
|
||||
- libvirt
|
||||
- libvirt-python
|
||||
- python-lxml
|
||||
- qemu-kvm-ev
|
||||
- bridge-utils
|
||||
- lzop
|
||||
- virt-backup
|
||||
|
||||
- name: Create libvirt group
|
||||
group: name=libvirt state=present
|
||||
|
||||
- name: Add admin users in libvirt group
|
||||
user:
|
||||
name: "{{ item }}"
|
||||
groups: libvirt
|
||||
append: yes
|
||||
with_items: system_admin_users
|
||||
|
||||
- name: Deploy libvirtd configuration
|
||||
template: src={{ item }}.j2 dest=/etc/libvirt/{{ item }} backup=yes mode=644
|
||||
with_items:
|
||||
- libvirtd.conf
|
||||
- qemu.conf
|
||||
notify: restart libvirtd
|
||||
|
||||
- name: Start and enable libvirtd
|
||||
service: name=libvirtd state=started enabled=yes
|
||||
|
||||
- name: Remove the default libvirt network
|
||||
virt_net: name=default state=absent
|
||||
|
||||
- name: Set guest concurrency suspend
|
||||
lineinfile:
|
||||
dest: /etc/sysconfig/libvirt-guests
|
||||
regexp: "#?PARALLEL_SHUTDOWN=.*"
|
||||
line: "PARALLEL_SHUTDOWN={{ libvirt_parallel_suspend }}"
|
||||
backup: yes
|
||||
|
||||
- name: Create system override directory
|
||||
file: path=/etc/systemd/system/libvirt-guests.service.d/ state=directory
|
||||
|
||||
- name: Add a systemd snippet to override the service stop timeout
|
||||
copy: src=libvirt-guests-timeout.conf dest=/etc/systemd/system/libvirt-guests.service.d/timeout.conf
|
||||
notify:
|
||||
- reload systemd
|
||||
|
||||
- name: Enable libvirt guest suspending support
|
||||
service: name=libvirt-guests enabled=yes
|
||||
|
||||
- name: Deploy sudo configuration
|
||||
template: src=sudo_libvirt.j2 dest=/etc/sudoers.d/backup_libvirt mode=400
|
||||
...
|
7
roles/libvirt_host/templates/libvirtd.conf.j2
Normal file
7
roles/libvirt_host/templates/libvirtd.conf.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
listen_tls = {{ libvirt_listen_tls | ternary('1', '0') }}
|
||||
listen_tcp = {{ libvirt_listen_tcp | ternary('1', '0') }}
|
||||
mdns_adv = 0
|
||||
unix_sock_group = "{{ libvirt_group }}"
|
||||
unix_sock_rw_perms = "0770"
|
||||
auth_unix_ro = "none"
|
||||
auth_unix_rw = "none"
|
1
roles/libvirt_host/templates/qemu.conf.j2
Normal file
1
roles/libvirt_host/templates/qemu.conf.j2
Normal file
@@ -0,0 +1 @@
|
||||
save_image_format = "{{ libvirt_qemu_save_format }}"
|
1
roles/libvirt_host/templates/sudo_libvirt.j2
Normal file
1
roles/libvirt_host/templates/sudo_libvirt.j2
Normal file
@@ -0,0 +1 @@
|
||||
lbkp ALL=(root) NOPASSWD: {{ libvirt_sudo_backup_commands | default (['/usr/bin/virt-backup']) | join(',') }}
|
Reference in New Issue
Block a user