--- - name: Set package fact ansible.builtin.set_fact: muninpkgs: - muninlite munin_need_reconfigure: false when: ansible_facts['distribution'] == "LEDE" or ansible_facts['distribution'] == "OpenWRT" or ansible_facts['distribution'] == "OpenWrt" - name: Set other packages fact ansible.builtin.set_fact: muninpkgs: - munin-node - munin-plugins-core - munin-plugins-extra munin_need_reconfigure: true when: ansible_facts['distribution'] == "Debian" - name: Install munin node packages ansible.builtin.package: name: "{{ item }}" state: present update_cache: true loop: "{{ muninpkgs }}" - name: Put munin-node configuration file ansible.builtin.template: src: munin-node.conf.j2 dest: /etc/munin/munin-node.conf mode: "0o644" notify: - Restart munin-node when: munin_need_reconfigure ## Adding modules for specific functions # for NginX webservers - name: Install LWP::UserAgent ansible.builtin.package: name: libwww-perl state: present update_cache: true notify: - Restart munin-node when: "'webservers' in group_names or 'lbservers' in group_names" # for HAProxy servers - name: Add haproxy backend module ansible.builtin.file: src: /usr/share/munin/plugins/haproxy_ dest: /etc/munin/plugins/haproxy_current state: link notify: - Restart munin-node when: "'lbservers' in group_names" # For MariaDB servers - name: Install MariaDB servers ansible.builtin.package: name: - libcache-cache-perl - libdbd-mysql-perl state: present update_cache: true notify: - Restart munin-node when: "'mariadbservers' in group_names" # For PGSQL servers - name: Install DBD::Pg ansible.builtin.package: name: libdbd-pg-perl state: present update_cache: true notify: - Restart munin-node when: "'pgsqlservers' in group_names" # For Munin servers - name: Execute specific tasks for munin servers ansible.builtin.include_tasks: mikrotik.yml when: "'muninservers' in group_names" # for NUT (UPS) servers - name: Add specific nut value for UPS ansible.builtin.file: path: "/etc/munin/plugins/nutups_eaton3s_{{ item }}" src: /usr/share/munin/plugins/nutups_ state: link notify: - Restart munin-node when: "'nut_server' in group_names" loop: - charge - voltages - name: Reconfigure munin-node ansible.builtin.shell: cmd: munin-node-configure --shell | sh # noqa: risky-shell-pipe changed_when: true notify: - Restart munin-node when: munin_need_reconfigure # Useless junks for everyone - name: Delete useless junks for everyone ansible.builtin.file: path: "/etc/munin/plugins/{{ item }}" state: absent when: munin_need_reconfigure loop: - users - name: Execute specific hypervisors’ commands ansible.builtin.include_tasks: hypervisors.yml when: "'hypervisors' in group_names" - name: Execute specific ZFS commands ansible.builtin.include_tasks: zfs.yml when: "'zfsservers' in group_names" # Adding modules for physical servers - name: Install physical sensors ansible.builtin.package: name: lm-sensors state: present update_cache: true when: "'physicalservers' in group_names" # Specific LXC commands - name: Execute specific LXC commands ansible.builtin.include_tasks: lxc.yml when: ansible_facts['virtualization_type'] == "lxc" # Specific garage commands - name: Execute specific garage commands ansible.builtin.include_tasks: garage.yml when: "'garageservers' in group_names" # Specific restic commands - name: Execute specific restic commands ansible.builtin.include_tasks: restic.yml when: "'resticservers' in group_names"