ansible-roles/kvm-host/tasks/tools.yml
Mathieu Trossevin 7c632352a0
Replace the include module with include_tasks or import_tasks
The behaviour of the `include` module is badly defined (it try to choose
between statically importing the tasks and dynamically including them)
and can cause problems depending on any number of constraints (mostly if
it choose the wrong behaviour).

Replace it with the `import_tasks` (always statically import tasks) unless
the `include` is in a loop in which case we replace it with
`include_tasks` (always dynamically include tasks).
2023-01-03 14:43:42 +01:00

68 lines
1.3 KiB
YAML

---
- name: remove old package
apt:
name: kvm-tools
purge: yes
state: absent
- include_role:
name: remount-usr
when: kvm_scripts_dir is search("/usr")
- name: add-vm script is present
copy:
src: add-vm.sh
dest: "{{ kvm_scripts_dir }}/add-vm"
mode: "0700"
owner: root
group: root
force: yes
- name: migrate-vm script is present
copy:
src: migrate-vm.sh
dest: "{{ kvm_scripts_dir }}/migrate-vm"
mode: "0700"
owner: root
group: root
force: yes
- name: kvmstats script is present
copy:
src: kvmstats.sh
dest: "{{ kvm_scripts_dir }}/kvmstats"
mode: "0700"
owner: root
group: root
force: yes
- name: kvmstats cron is present
template:
src: kvmstats.cron.j2
dest: "/etc/cron.hourly/kvmstats"
mode: "0755"
owner: root
group: root
- name: entry for kvmstats in web page is present
lineinfile:
dest: /var/www/index.html
insertbefore: '</ul>'
line: '<li><a href="/kvmstats.html">kvmstats</a></li>'
# backward compatibility
- name: remove old migrate-vm script
file:
path: /usr/share/scripts/migrate-vm
state: absent
when: "'/usr/share/scripts' not in kvm_scripts_dir"
- name: remove old kvmstats script
file:
path: /usr/share/scripts/kvmstats
state: absent
when: "'/usr/share/scripts' not in kvm_scripts_dir"