create vms as libvirt user instead of root
This commit is contained in:
parent
3d5296bb4f
commit
ff64a7b408
1 changed files with 7 additions and 1 deletions
|
@ -25,9 +25,13 @@
|
||||||
- name: generate libvirt xml files for clients
|
- name: generate libvirt xml files for clients
|
||||||
template:
|
template:
|
||||||
src: client-libvirt.xml.j2
|
src: client-libvirt.xml.j2
|
||||||
dest: /root/{{ item.hostname }}.libvirt.xml
|
dest: /home/{{ libvirt_user }}/{{ item.hostname }}.libvirt.xml
|
||||||
|
owner: "{{ libvirt_user }}"
|
||||||
|
group: "{{ libvirt_user }}"
|
||||||
when: item.hostname not in result.list_vms
|
when: item.hostname not in result.list_vms
|
||||||
with_items: clients
|
with_items: clients
|
||||||
|
sudo: true
|
||||||
|
sudo_user: "{{ libvirt_user }}"
|
||||||
|
|
||||||
- name: ensure the guest lvs are created
|
- name: ensure the guest lvs are created
|
||||||
lvol: lv={{ item.hostname }} vg={{ volgroup }} size={{ item.lvm_size }} state=present
|
lvol: lv={{ item.hostname }} vg={{ volgroup }} size={{ item.lvm_size }} state=present
|
||||||
|
@ -38,4 +42,6 @@
|
||||||
command: "virsh define --file /root/{{ item.hostname }}.libvirt.xml"
|
command: "virsh define --file /root/{{ item.hostname }}.libvirt.xml"
|
||||||
when: item.hostname not in result.list_vms
|
when: item.hostname not in result.list_vms
|
||||||
with_items: clients
|
with_items: clients
|
||||||
|
sudo: true
|
||||||
|
sudo_user: "{{ libvirt_user }}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue