added psutil

This commit is contained in:
2025-11-21 19:48:04 +01:00
parent 7ace61c513
commit 059f38debd
+40
View File
@@ -49,6 +49,46 @@
- ansible_facts['os_family'] == 'FreeBSD'
- 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
ansible.builtin.copy:
src: memory_usage_check.py