added psutil
This commit is contained in:
@@ -49,6 +49,46 @@
|
|||||||
- ansible_facts['os_family'] == 'FreeBSD'
|
- ansible_facts['os_family'] == 'FreeBSD'
|
||||||
- not nrpe_installed
|
- not nrpe_installed
|
||||||
|
|
||||||
|
- name: Set psutil_installed fact if any package name contains "psutil"
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
psutil_installed: "{{ (ansible_facts.packages | default({}) | dict2items | map(attribute='key') | select('search','psutil') | list) | length > 0 }}"
|
||||||
|
|
||||||
|
- name: Debug psutil presence
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "psutil already installed on host."
|
||||||
|
when: psutil_installed
|
||||||
|
|
||||||
|
- name: Ensure python3-psutil is installed (Debian/Ubuntu)
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: python3-psutil
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
register: psutil_install_result
|
||||||
|
when:
|
||||||
|
- ansible_facts['os_family'] == 'Debian'
|
||||||
|
- not psutil_installed
|
||||||
|
|
||||||
|
- name: Ensure python3-psutil is installed (RedHat/CentOS)
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name: python3-psutil
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
register: psutil_install_result
|
||||||
|
when:
|
||||||
|
- ansible_facts['os_family'] == 'RedHat'
|
||||||
|
- not psutil_installed
|
||||||
|
|
||||||
|
- name: Ensure psutil is installed (FreeBSD)
|
||||||
|
ansible.builtin.pkg:
|
||||||
|
name: python3-psutil
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
register: psutil_install_result
|
||||||
|
when:
|
||||||
|
- ansible_facts['os_family'] == 'FreeBSD'
|
||||||
|
- not psutil_installed
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy custom Nagios/NRPE script
|
- name: Deploy custom Nagios/NRPE script
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: memory_usage_check.py
|
src: memory_usage_check.py
|
||||||
|
|||||||
Reference in New Issue
Block a user