style: make ansible-lint happier
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
|
||||
- name: restart munin-node
|
||||
service:
|
||||
- name: Restart munin-node
|
||||
ansible.builtin.service:
|
||||
name: munin-node
|
||||
state: restarted
|
||||
|
@@ -1,11 +1,15 @@
|
||||
---
|
||||
|
||||
- name: delete squid plugins
|
||||
shell: "rm -f /etc/munin/plugins/squid_*"
|
||||
- name: Delete squid plugins
|
||||
ansible.builtin.command:
|
||||
cmd: "rm -f /etc/munin/plugins/squid_*"
|
||||
changed_when: true
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
|
||||
- name: delete lxc interfaces plugins
|
||||
shell: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*"
|
||||
- name: Delete lxc interfaces plugins
|
||||
ansible.builtin.command:
|
||||
cmd: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*"
|
||||
changed_when: true
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
|
@@ -1,12 +1,14 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
- 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"
|
||||
|
||||
- set_fact:
|
||||
- name: Set other packages fact
|
||||
ansible.builtin.set_fact:
|
||||
muninpkgs:
|
||||
- munin-node
|
||||
- munin-plugins-core
|
||||
@@ -14,91 +16,93 @@
|
||||
munin_need_reconfigure: true
|
||||
when: ansible_facts['distribution'] == "Debian"
|
||||
|
||||
- name: install munin node packages
|
||||
package:
|
||||
- name: Install munin node packages
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ muninpkgs }}"
|
||||
|
||||
- name: munin-node conf file
|
||||
template:
|
||||
- name: Munin-node conf file
|
||||
ansible.builtin.template:
|
||||
src: munin-node.conf.j2
|
||||
dest: /etc/munin/munin-node.conf
|
||||
mode: 0644
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: munin_need_reconfigure
|
||||
|
||||
## Adding modules for specific functions
|
||||
# for NginX webservers
|
||||
- name: install LWP::UserAgent
|
||||
package:
|
||||
- name: Install LWP::UserAgent
|
||||
ansible.builtin.package:
|
||||
name: libwww-perl
|
||||
state: present
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: "'webservers' in group_names or 'loadbalancers' in group_names"
|
||||
|
||||
# for HAProxy servers
|
||||
- name: add HAProxy backend module
|
||||
file:
|
||||
- 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
|
||||
- Restart munin-node
|
||||
when: "'loadbalancers' in group_names"
|
||||
|
||||
# For MariaDB servers
|
||||
- name: install Cache::Cache
|
||||
package:
|
||||
- name: Install Cache::Cache
|
||||
ansible.builtin.package:
|
||||
name: libcache-cache-perl
|
||||
state: present
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: "'mariadbservers' in group_names"
|
||||
|
||||
# For PGSQL servers
|
||||
- name: install DBD::Pg
|
||||
package:
|
||||
- name: Install DBD::Pg
|
||||
ansible.builtin.package:
|
||||
name: libdbd-pg-perl
|
||||
state: present
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: "'pgsqlservers' in group_names"
|
||||
|
||||
# For Munin servers
|
||||
- name: execute specific tasks for munin servers
|
||||
include_tasks: mikrotik.yml
|
||||
- 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"
|
||||
file:
|
||||
- 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
|
||||
- Restart munin-node
|
||||
when: "'nut_server' in group_names"
|
||||
loop:
|
||||
- charge
|
||||
- voltages
|
||||
|
||||
# for physical servers
|
||||
- name: execute specific tasks for physical servers
|
||||
include_tasks: physical_servers.yml
|
||||
- name: Execute specific tasks for physical servers
|
||||
ansible.builtin.include_tasks: physical_servers.yml
|
||||
when: "'hypervisors' in group_names"
|
||||
|
||||
- name: reconfigure munin-node
|
||||
shell:
|
||||
- name: Reconfigure munin-node
|
||||
ansible.builtin.command:
|
||||
cmd: munin-node-configure --shell | sh
|
||||
changed_when: true
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: munin_need_reconfigure
|
||||
|
||||
## Useless junks for everyone
|
||||
- name: delete useless junks for everyone
|
||||
file:
|
||||
- name: Delete useless junks for everyone
|
||||
ansible.builtin.file:
|
||||
path: "/etc/munin/plugins/{{ item }}"
|
||||
state: absent
|
||||
when: munin_need_reconfigure
|
||||
@@ -106,12 +110,12 @@
|
||||
- users
|
||||
|
||||
## Useless junks for LXC
|
||||
- name: "delete junks from LXC machines"
|
||||
file:
|
||||
- name: "Delete junks from LXC machines"
|
||||
ansible.builtin.file:
|
||||
path: "/etc/munin/plugins/{{ item }}"
|
||||
state: absent
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
when: ansible_facts['virtualization_type'] == "lxc"
|
||||
loop:
|
||||
- acpi
|
||||
@@ -121,6 +125,6 @@
|
||||
- irqstats
|
||||
|
||||
## Useless junks for hypervisors
|
||||
- name: execute delete states for hypervisors
|
||||
include_tasks: hypervisors.yml
|
||||
- name: Execute delete states for hypervisors
|
||||
ansible.builtin.include_tasks: hypervisors.yml
|
||||
when: "'hypervisors' in group_names"
|
||||
|
@@ -1,21 +1,21 @@
|
||||
---
|
||||
|
||||
- name: deploy mikrotik unitary scripts
|
||||
copy:
|
||||
- name: Deploy mikrotik unitary scripts
|
||||
ansible.builtin.copy:
|
||||
src: "./files/{{ item.0 }}"
|
||||
dest: "/etc/munin/plugins/{{ item.0 }}{{ item.1.name }}"
|
||||
mode: 0755
|
||||
loop: "{{ mikrotik_unitary_scripts|product(mikrotik_hosts)|list }}"
|
||||
loop: "{{ mikrotik_unitary_scripts | product(mikrotik_hosts) | list }}"
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
|
||||
- name: deploy mikrotik per iface scripts
|
||||
copy:
|
||||
- name: Deploy mikrotik per iface scripts
|
||||
ansible.builtin.copy:
|
||||
src: "./files/{{ item.1 }}"
|
||||
dest: "/etc/munin/plugins/{{ item.1 }}{{ item.0.0.name }}_{{ item.0.1 }}"
|
||||
mode: 0755
|
||||
loop: "{{ mikrotik_hosts|subelements('ifaces')|product(mikrotik_periface_scripts) }}"
|
||||
loop: "{{ mikrotik_hosts | subelements('ifaces') | product(mikrotik_periface_scripts) }}"
|
||||
loop_control:
|
||||
label: "{{ item.0.1 }}"
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
|
@@ -1,16 +1,16 @@
|
||||
---
|
||||
# for physical servers
|
||||
- name: install necessary packages for hypervisors
|
||||
package:
|
||||
- name: Install necessary packages for hypervisors
|
||||
ansible.builtin.package:
|
||||
name: lm-sensors
|
||||
state: present
|
||||
|
||||
- name: configure specific munin plugin
|
||||
file:
|
||||
- name: Configure specific munin plugin
|
||||
ansible.builtin.file:
|
||||
path: "/etc/munin/plugins/sensors_{{ item }}"
|
||||
src: /usr/share/munin/plugins/sensors_
|
||||
state: link
|
||||
notify:
|
||||
- restart munin-node
|
||||
- Restart munin-node
|
||||
loop:
|
||||
- temp
|
||||
|
Reference in New Issue
Block a user