kvm-tools/kvmstats/deploy-kvmstats.yml
Alexis Ben Miloud--Josselin e03cf46089
All checks were successful
continuous-integration/drone/push Build is passing
[kvmstats] Replace old kvmstats script if it exists
2021-01-19 11:37:52 +01:00

50 lines
1.2 KiB
YAML

###
# ansible-playbook -l $hosts -K --diff --check deploy-kvmstats.yml
---
- hosts: all
become: yes
pre_tasks:
- include_role:
name: etc-git
tasks_from: commit.yml
vars:
commit_message: "Ansible pre-run deploy-kvmstats.yml"
- include_role:
name: evolix/remount-usr
tasks:
- name: kvmstats is installed
copy:
src: kvmstats
dest: /usr/share/scripts/kvmstats
mode: "0700"
- name: cron for kvmstats is installed
copy:
src: kvmstats.cron
dest: /etc/cron.hourly/kvmstats
mode: "0755"
- 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>'
- name: old kvmstats exists
stat:
path: /usr/sbin/kvmstats
register: oldkvmstats
- name: kvmstats is dead, long live kvmstats!
file:
state: link
src: /usr/share/scripts/kvmstats
path: /usr/sbin/kvmstats
force: yes
when: oldkvmstats.stat.islnk is defined and oldkvmstats.stat.islnk == False
post_tasks:
- include_role:
name: etc-git
tasks_from: commit.yml
vars:
commit_message: "Ansible post-run check_ssl.yml"