re-activation task ssh.yml + modify crontab for sync list of running vm + add tags
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Eric Morino 2021-11-22 11:38:10 +01:00
parent 21bd4021d3
commit c9af7db827
2 changed files with 16 additions and 14 deletions

View File

@ -5,7 +5,7 @@
when: kvm_install_drbd
## TODO: check why it's disabled
#- include: ssh.yml
- include: ssh.yml
- include: packages.yml

View File

@ -15,17 +15,17 @@
debug:
msg: "{{ ssh_keys.stdout }}"
- name: Autorize other kvm ssh key
authorized_key:
user: root
state: present
key: "{{ item[0] }}"
delegate_to: "{{ item[1] }}"
loop: "{{ _keys | product(_servers) | list }}"
vars:
_keys: ssh_keys.stdout
_servers: groups['hypervisors']
when: item[1] != inventory_hostname
#- name: Autorize other kvm ssh key
# authorized_key:
# user: root
# state: present
# key: "{{ item[0] }}"
# delegate_to: "{{ item[1] }}"
# loop: "{{ _keys | product(_servers) | list }}"
# vars:
# _keys: ssh_keys.stdout
# _servers: groups['hypervisors']
# when: item[1] != inventory_hostname
- name: Crontab for sync libvirt xml file
cron:
@ -33,9 +33,10 @@
state: present
special_time: "hourly"
user: root
job: "rsync -a --delete /etc/libvirt/qemu/ {{ hostvars[item]['ansible_hostname'] }}:/root/libvirt-{{ inventory_hostname }}/"
job: "rsync -a --delete /etc/libvirt/qemu/ {{ hostvars[item]['ansible_pair'] }}:/root/libvirt-{{ inventory_hostname }}/"
loop: "{{ groups['hypervisors'] }}"
when: item != inventory_hostname
tags: crontab
- name: Crontab for sync list of running vm
cron:
@ -43,6 +44,7 @@
state: present
special_time: "daily"
user: root
job: "virsh list --all | tee /root/virsh-list.txt | ssh {{ hostvars[item]['ansible_hostname'] }} 'cat >/root/libvirt-{{ inventory_hostname }}/virsh-list.txt'"
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
tags: crontab