Change variable item by kvm_pair and disable loop on all 'hypervisor' group
continuous-integration/drone/push Build is failing Details

evoacme-v2
Eric Morino 1 year ago
parent 53cd3ba342
commit 2ec026c2b3

@ -29,22 +29,20 @@
- name: Crontab for sync libvirt xml file
cron:
name: "sync libvirt xml on {{ item }}"
name: "sync libvirt xml on {{ kvm_pair }}"
state: present
special_time: "hourly"
user: root
job: "rsync -a --delete /etc/libvirt/qemu/*xml {{ hostvars[item]['ansible_pair'] }}:/root/libvirt-{{ inventory_hostname }}/"
loop: "{{ groups['hypervisors'] }}"
when: item != inventory_hostname
job: "rsync -a --delete /etc/libvirt/qemu/*xml {{ hostvars[kvm_pair]['lan.ip'] }}:/root/libvirt-{{ inventory_hostname }}/"
when: kvm_pair != inventory_hostname
tags: crontab
- name: Crontab for sync list of running vm
cron:
name: "sync list of libvirt running vm on {{ item }}"
name: "sync list of libvirt running vm on {{ kvm_pair }}"
state: present
special_time: "daily"
user: root
job: "virsh list --all | tee /root/virsh-list.txt | ssh {{ hostvars[item]['ansible_pair'] }} 'cat >/root/libvirt-{{ inventory_hostname }}/virsh-list.txt'"
loop: "{{ groups['hypervisors'] }}"
when: item != inventory_hostname
job: "virsh list --all | tee /root/virsh-list.txt | ssh {{ hostvars[kvm_pair]['lan.ip'] }} 'cat >/root/libvirt-{{ inventory_hostname }}/virsh-list.txt'"
when: kvm_pair != inventory_hostname
tags: crontab

Loading…
Cancel
Save