create vms as libvirt user instead of root

This commit is contained in:
Tim Flink 2015-05-07 19:04:34 +00:00
parent 3d5296bb4f
commit ff64a7b408

View file

@ -25,9 +25,13 @@
- name: generate libvirt xml files for clients
template:
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
with_items: clients
sudo: true
sudo_user: "{{ libvirt_user }}"
- name: ensure the guest lvs are created
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"
when: item.hostname not in result.list_vms
with_items: clients
sudo: true
sudo_user: "{{ libvirt_user }}"