Change variable item by kvm_pair and disable loop on all 'hypervisor' group
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
53cd3ba342
commit
2ec026c2b3
|
@ -29,22 +29,20 @@
|
||||||
|
|
||||||
- name: Crontab for sync libvirt xml file
|
- name: Crontab for sync libvirt xml file
|
||||||
cron:
|
cron:
|
||||||
name: "sync libvirt xml on {{ item }}"
|
name: "sync libvirt xml on {{ kvm_pair }}"
|
||||||
state: present
|
state: present
|
||||||
special_time: "hourly"
|
special_time: "hourly"
|
||||||
user: root
|
user: root
|
||||||
job: "rsync -a --delete /etc/libvirt/qemu/*xml {{ hostvars[item]['ansible_pair'] }}:/root/libvirt-{{ inventory_hostname }}/"
|
job: "rsync -a --delete /etc/libvirt/qemu/*xml {{ hostvars[kvm_pair]['lan.ip'] }}:/root/libvirt-{{ inventory_hostname }}/"
|
||||||
loop: "{{ groups['hypervisors'] }}"
|
when: kvm_pair != inventory_hostname
|
||||||
when: item != inventory_hostname
|
|
||||||
tags: crontab
|
tags: crontab
|
||||||
|
|
||||||
- name: Crontab for sync list of running vm
|
- name: Crontab for sync list of running vm
|
||||||
cron:
|
cron:
|
||||||
name: "sync list of libvirt running vm on {{ item }}"
|
name: "sync list of libvirt running vm on {{ kvm_pair }}"
|
||||||
state: present
|
state: present
|
||||||
special_time: "daily"
|
special_time: "daily"
|
||||||
user: root
|
user: root
|
||||||
job: "virsh list --all | tee /root/virsh-list.txt | ssh {{ hostvars[item]['ansible_pair'] }} 'cat >/root/libvirt-{{ inventory_hostname }}/virsh-list.txt'"
|
job: "virsh list --all | tee /root/virsh-list.txt | ssh {{ hostvars[kvm_pair]['lan.ip'] }} 'cat >/root/libvirt-{{ inventory_hostname }}/virsh-list.txt'"
|
||||||
loop: "{{ groups['hypervisors'] }}"
|
when: kvm_pair != inventory_hostname
|
||||||
when: item != inventory_hostname
|
|
||||||
tags: crontab
|
tags: crontab
|
||||||
|
|
Loading…
Reference in a new issue