diff --git a/kvmstats/deploy-kvmstats.yml b/kvmstats/deploy-kvmstats.yml new file mode 100644 index 0000000..8a78141 --- /dev/null +++ b/kvmstats/deploy-kvmstats.yml @@ -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: '' + line: '
  • kvmstats
  • ' diff --git a/kvmstats b/kvmstats/kvmstats similarity index 92% rename from kvmstats rename to kvmstats/kvmstats index 5d0e9da..307377c 100755 --- a/kvmstats +++ b/kvmstats/kvmstats @@ -85,7 +85,7 @@ done | xargs -n5 | { column -t ;; 'html') - awk 'BEGIN{print ""}{printf "";for(i=1;i<=NF;i++)printf "", $i;print ""}END{print "
    %s
    "}' + awk 'BEGIN{print "\n"}{printf "";for(i=1;i<=NF;i++)printf "", $i;print ""}END{print "
    %s
    \n"}' ;; 'csv') tr ' ' ',' diff --git a/kvmstats/kvmstats.cron b/kvmstats/kvmstats.cron new file mode 100644 index 0000000..b088181 --- /dev/null +++ b/kvmstats/kvmstats.cron @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/share/scripts/kvmstats -o html > /var/www/kvmstats.html +/bin/chmod go+r /var/www/kvmstats.html