added psutil
This commit is contained in:
@@ -48,6 +48,46 @@
|
||||
when:
|
||||
- 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:
|
||||
|
||||
Reference in New Issue
Block a user