start od deployment

This commit is contained in:
2025-11-20 18:13:43 +01:00
parent 77badc1d74
commit 5ca8d0defd
4 changed files with 101 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
psutil
+36
View File
@@ -0,0 +1,36 @@
# Example: Check if /opt/app exists on remote hosts
- name: Check if /opt/app directory exists
stat:
path: /opt/ansible_workdir
register: app_dir
- name: Debug app_dir result
debug:
var: app_dir.stat.exists
- name: Ensure /opt/app directory exists
file:
path: {{ app_dir.stat.path }}
state: directory
owner: root
group: root
mode: '0755'
when: app_dir.stat.exists == false
- name: Ensure python requirements file is present
ansible.builtin.copy:
src: requirements.txt
dest: "{{ app_dir.stat.path }}/requirements.txt"
mode: '0644'
when: app_dir.stat.exists == true and python_requirements is defined
- name: Install specified python requirements
ansible.builtin.pip:
requirements: "{{ app_dir.stat.path }}/requirements.txt"
when: app_dir.stat.exists == true and python_requirements is defined
- name: Deploy custom Nagios/NRPE script
ansible.builtin.copy:
src: memory_usage_check.py
dest: /usr/local/nagios/libexec/my_custom_check.py
mode: '0755'
+1
View File
@@ -0,0 +1 @@
python_requirements: true