pvc-ansible/roles/pvc/tasks/libvirt.yml

48 lines
1.1 KiB
YAML
Raw Normal View History

2019-06-09 00:11:06 -04:00
---
- name: install libvirt packages
apt:
name:
- libvirt-daemon-system
- qemu-kvm
- qemu-utils
- qemu-block-extra
- vhostmd
- ceph-common
- libjemalloc2
state: latest
- name: install libvirt configuration
template:
src: libvirt/{{ item }}.j2
dest: /etc/libvirt/{{ item }}
with_items:
- libvirtd.conf
- ceph-secret.xml
notify: restart libvirtd
2019-06-11 13:30:55 -04:00
- name: get ceph libvirt secret key
command: ceph auth get-key client.libvirt
register: libvirt_key
2019-06-09 00:11:06 -04:00
- name: define ceph secret
command: virsh secret-define /etc/libvirt/ceph-secret.xml
ignore_errors: true
2019-06-11 13:30:55 -04:00
- name: set ceph libvirt secret value
command: virsh secret-set-value --secret {{ ceph_storage_secret_uuid }} --base64 {{ libvirt_key.stdout }}
2019-06-09 00:11:06 -04:00
ignore_errors: true
- name: configure libvirt for listening
replace:
dest: /etc/default/libvirtd
regexp: '#libvirtd_opts=""'
replace: 'libvirtd_opts="--listen"'
notify: restart libvirtd
- name: disable services
service:
name: "{{ item }}"
enabled: no
with_items:
- libvirtd