- name: Install munin apt: pkg={{ packages }} vars: packages: - munin - rrdcached - libcgi-fast-perl - name: Configure rrdcached lineinfile: "dest=/etc/default/rrdcached regexp='^#?{{ item.name }}=' line='{{ item.name }}=\"{{ item.value }}\"'" with_items: - { name: 'BASE_OPTIONS', value: '-B -F' } - { name: 'BASE_PATH', value: '/var/lib/munin' } - { name: 'SOCKFILE', value: '/run/rrdcached.sock' } - { name: 'SOCKGROUP', value: 'munin' } - { name: 'SOCKMODE', value: '0660' } - { name: 'WRITE_TIMEOUT', value: '1800' } register: r notify: - Restart rrdcached - name: Start rrdcached service: name=rrdcached state=started when: not r.changed - meta: flush_handlers - name: Create directory /var/lib/munin/cgi-tmp/munin-cgi-graph file: path=/var/lib/munin/cgi-tmp/munin-cgi-graph state=directory owner=www-data group=www-data mode=0755 - name: Configure munin template: src=etc/munin/munin.conf.j2 dest=/etc/munin/munin.conf owner=root group=root mode=0644 notify: - Restart munin-cgi-graph - Restart munin-cgi-html - name: chown www-data:adm /var/log/munin/munin-cgi-{graph,html}.log file: path=/var/log/munin/{{ item }} owner=www-data group=adm mode=0640 with_items: - munin-cgi-graph.log - munin-cgi-html.log - name: Copy munin-cgi-graph.{service,socket} copy: src=etc/systemd/system/{{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644 notify: - systemctl daemon-reload - Restart munin-cgi-graph with_items: - munin-cgi-graph.service - munin-cgi-graph.socket - name: Copy munin-cgi-html.{service,socket} copy: src=etc/systemd/system/{{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644 notify: - systemctl daemon-reload - Restart munin-cgi-html with_items: - munin-cgi-html.service - munin-cgi-html.socket - meta: flush_handlers - name: Start munin-cgi-{graph,html} service: name={{ item }} state=started enabled=yes with_items: - munin-cgi-graph - munin-cgi-html - name: Copy /etc/nginx/sites-available/munin copy: src=etc/nginx/sites-available/munin dest=/etc/nginx/sites-available/munin owner=root group=root mode=0644 register: r1 notify: - Restart Nginx - name: Create /etc/nginx/sites-enabled/munin file: src=../sites-available/munin dest=/etc/nginx/sites-enabled/munin owner=root group=root state=link force=yes register: r2 notify: - Restart Nginx - name: Start Nginx service: name=nginx state=started when: not (r1.changed or r2.changed) - meta: flush_handlers - name: Install 'munin_stats' and 'munin_update' plugins file: src=/usr/share/munin/plugins/{{ item }} dest=/etc/munin/plugins/{{ item }} owner=root group=root state=link force=yes with_items: - munin_stats - munin_update tags: - munin-node - munin notify: - Restart munin-node