87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
---
|
|
|
|
- name: "Remount /usr if needed"
|
|
ansible.builtin.include_role:
|
|
name: remount-usr
|
|
|
|
- name: "dir /usr/local/lib/monitoringctl/ exists"
|
|
ansible.builtin.file:
|
|
path: /usr/local/lib/monitoringctl/
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: "check if old alerts_switch script is present"
|
|
ansible.builtin.stat:
|
|
path: /usr/share/scripts/alerts_switch
|
|
register: old_alerts_switch
|
|
|
|
- name: "alerts_switch is at the right place"
|
|
ansible.builtin.command:
|
|
cmd: "mv /usr/share/scripts/alerts_switch /usr/local/bin/alerts_switch"
|
|
args:
|
|
creates: /usr/local/bin/alerts_switch
|
|
when: old_alerts_switch.stat.exists
|
|
|
|
- name: "copy alerts_switch"
|
|
ansible.builtin.copy:
|
|
src: alerts_switch
|
|
dest: /usr/local/bin/alerts_switch
|
|
owner: root
|
|
group: root
|
|
mode: "0750"
|
|
force: true
|
|
|
|
- name: "alerts_switch symlink for backward compatibility"
|
|
ansible.builtin.file:
|
|
src: /usr/local/bin/alerts_switch
|
|
path: /usr/share/scripts/alerts_switch
|
|
state: link
|
|
when: old_alerts_switch.stat.exists
|
|
|
|
- name: "Nagios user can run alerts_switch with sudo (used by alerts_wrapper)"
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/sudoers.d/evolinux
|
|
regexp: "nagios.*alerts_switch"
|
|
line: "nagios ALL = NOPASSWD:/usr/local/bin/alerts_switch *"
|
|
owner: root
|
|
group: root
|
|
mode: "640"
|
|
validate: "visudo -c -f %s"
|
|
|
|
- name: "check if old alerts_wrapper script is present"
|
|
ansible.builtin.stat:
|
|
path: "{{ nagios_plugins_directory }}/alerts_wrapper"
|
|
register: old_alerts_wrapper
|
|
|
|
- name: "alerts_wrapper is at the right place"
|
|
ansible.builtin.command:
|
|
cmd: "mv {{ nagios_plugins_directory }}/alerts_wrapper /usr/local/lib/monitoringctl/alerts_wrapper"
|
|
creates: /usr/local/lib/monitoringctl/alerts_wrapper
|
|
when: old_alerts_wrapper.stat.exists
|
|
|
|
- name: "copy alerts_wrapper"
|
|
ansible.builtin.copy:
|
|
src: alerts_wrapper
|
|
dest: "/usr/local/lib/monitoringctl/alerts_wrapper"
|
|
owner: root
|
|
group: staff
|
|
mode: "0755"
|
|
force: true
|
|
|
|
- name: "alerts_wrapper symlink for backward compatibility"
|
|
ansible.builtin.file:
|
|
src: /usr/local/lib/monitoringctl/alerts_wrapper
|
|
path: "{{ nagios_plugins_directory }}/alerts_wrapper"
|
|
state: link
|
|
when: old_alerts_wrapper.stat.exists
|
|
|
|
- name: "copy monitoringctl_common lib"
|
|
ansible.builtin.copy:
|
|
src: monitoringctl_common
|
|
dest: /usr/local/lib/monitoringctl/common
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
force: true
|
|
|