Add kvm role

This commit is contained in:
Victor LABORIE 2016-12-16 12:26:29 +01:00 committed by Jérémy Lecour
parent d4a41457cb
commit 65596db347
5 changed files with 60 additions and 0 deletions

2
kvm/files/munin-plugins Normal file
View file

@ -0,0 +1,2 @@
[kvm_io]
user root

5
kvm/handlers/main.yml Normal file
View file

@ -0,0 +1,5 @@
---
- name: restart munin-node
service:
name: munin-node
state: restarted

8
kvm/tasks/main.yml Normal file
View file

@ -0,0 +1,8 @@
---
- include: packages.yml
- name: Mount /usr in rw
command: mount -o remount,rw /usr warn=no
changed_when: False
- include: munin.yml

33
kvm/tasks/munin.yml Normal file
View file

@ -0,0 +1,33 @@
---
- file:
path: '/usr/local/share/munin/plugins/'
state: directory
mode: 02755
- name: Get Munin plugins
get_url:
url: "https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/virtualization/{{ item }}"
dest: '/usr/local/share/munin/plugins/'
mode: 0755
with_items:
- 'kvm_cpu'
- 'kvm_io'
- 'kvm_mem'
notify: restart munin-node
- name: Activate Munin plugins
file:
src: "/usr/local/share/munin/plugins/{{ item }}"
dest: "/etc/munin/plugins/{{ item }}"
state: link
with_items:
- 'kvm_cpu'
- 'kvm_io'
- 'kvm_mem'
notify: restart munin-node
- name: Copy Munin plugins conf
copy:
src: files/munin-plugins
dest: '/etc/munin/plugin-conf.d/kvm'
notify: restart munin-node

12
kvm/tasks/packages.yml Normal file
View file

@ -0,0 +1,12 @@
---
- name: Install dependency
apt:
name: "{{ item }}"
with_items:
- libvirt-bin
- qemu-kvm
- netcat-openbsd
- bridge-utils
- qemu-utils
- virtinst
- lvm2