[kvmstats] add playbook to deploy kvmstats
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Also add a cron to update the stats.
This commit is contained in:
parent
e246f02058
commit
15e2165213
22
kvmstats/deploy-kvmstats.yml
Normal file
22
kvmstats/deploy-kvmstats.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
###
|
||||
# ansible-playbook -l $hosts -K --diff --check deploy-kvmstats.yml
|
||||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
|
||||
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>'
|
|
@ -85,7 +85,7 @@ done | xargs -n5 | {
|
|||
column -t
|
||||
;;
|
||||
'html')
|
||||
awk 'BEGIN{print "<html><body><table>"}{printf "<tr>";for(i=1;i<=NF;i++)printf "<td>%s</td>", $i;print "</tr>"}END{print "</table></body></html>"}'
|
||||
awk 'BEGIN{print "<html><body>\n<table>"}{printf "<tr>";for(i=1;i<=NF;i++)printf "<td>%s</td>", $i;print "</tr>"}END{print "</table>\n</body></html>"}'
|
||||
;;
|
||||
'csv')
|
||||
tr ' ' ','
|
3
kvmstats/kvmstats.cron
Normal file
3
kvmstats/kvmstats.cron
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
/usr/share/scripts/kvmstats -o html > /var/www/kvmstats.html
|
||||
/bin/chmod go+r /var/www/kvmstats.html
|
Loading…
Reference in a new issue