munin.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. - name: Install munin packages
  2. action: ${ansible_pkg_mgr} pkg=munin state=installed update_cache=yes
  3. when_boolean: ${with_munin}
  4. - name: Install munin configuration
  5. action: template src=munin/munin.conf.j2 dest=/etc/munin/munin.conf owner=root group=root mode=0644
  6. when_boolean: ${with_munin}
  7. - name: Install munin-node packages
  8. action: ${ansible_pkg_mgr} pkg=${item} state=installed update_cache=yes
  9. with_items:
  10. - munin-node
  11. - munin-plugins-extra
  12. - libnet-cidr-perl
  13. - libcache-cache-perl
  14. - libdbd-pg-perl
  15. - libdbd-mysql-perl
  16. - liblwp-useragent-determined-perl
  17. when_boolean: ${with_munin_node}
  18. - name: Create need directories for munin-node configuration
  19. action: file path=/etc/munin/${item} state=directory owner=root group=root mode=0755
  20. with_items:
  21. - plugins
  22. - plugin-conf.d
  23. when_boolean: ${with_munin_node}
  24. - name: Install munin node configuration
  25. action: template src=munin/munin-node.conf.j2 dest=/etc/munin/munin-node.conf owner=root group=root mode=0644
  26. notify:
  27. - Restart munin-node
  28. when_boolean: ${with_munin_node}
  29. - name: Install munin node plugins configuration
  30. action: template src=munin/munin-node.conf.plugins.j2 dest=/etc/munin/plugin-conf.d/munin-node owner=root group=root mode=0644
  31. notify:
  32. - Restart munin-node
  33. when_boolean: ${with_munin_node}
  34. - name: Autoconfigure munin-node plugins
  35. action: munin_node_autoconf families=auto,manual,contrib excludes=apc_nis,apt,apt_all,port_,ipmi_fans,ipmi_power,ipmi_temp,ntp_,ircu,ntp_kernel_err,ntp_kernel_pll_freq,ntp_kernel_pll_off,ntp_offset,ntp_states
  36. notify:
  37. - Restart munin-node
  38. when_boolean: ${with_munin_node}
  39. - name: Install nginx virtual host for munin (sites-available)
  40. action: template src=munin/nginx_vhost.j2 dest=/etc/nginx/sites-available/munin owner=root group=root mode=0644
  41. notify:
  42. - Reload nginx for munin
  43. when_boolean: ${with_munin} and ${with_nginx}
  44. - name: Install nginx virtual host for munin (sites-enabled)
  45. action: file src=/etc/nginx/sites-available/munin path=/etc/nginx/sites-enabled/munin state=link
  46. notify:
  47. - Reload nginx for munin
  48. when_boolean: ${with_munin} and ${with_nginx}
  49. - name: Install apache2 virtual host for munin (sites-available)
  50. action: template src=munin/apache2_vhost.j2 dest=/etc/apache2/sites-available/munin owner=root group=root mode=0644
  51. notify:
  52. - Reload apache2 for munin
  53. when_boolean: ${with_munin} and ${with_apache2}
  54. - name: Install apache2 virtual host for munin (sites-enabled)
  55. action: file src=/etc/apache2/sites-available/munin path=/etc/apache2/sites-enabled/munin state=link
  56. notify:
  57. - Reload apache2 for munin
  58. when_boolean: ${with_munin} and ${with_apache2}
  59. - name: Ensure munin-node is running
  60. action: service name=munin-node state=started
  61. when_boolean: ${with_munin_node}