Files
2025-11-21 19:49:50 +01:00

45 lines
1.1 KiB
YAML

# Example: Check if /opt/app exists on remote hosts
- name: Check if /opt/app directory exists
stat:
path: "{{ ansible_workdir }}"
register: app_dir
- name: Debug app_dir result
debug:
msg: "{{ ansible_workdir }} is the place to be"
- name: Debug app_dir result
debug:
var: app_dir.stat.exists
- name: Ensure /opt/app directory exists
file:
path: "{{ ansible_workdir }}"
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: "{{ ansible_workdir }}/requirements.txt"
# mode: '0644'
# owner: root
# group: root
# force: yes
# when: app_dir.stat.exists == true and python_requirements is defined
#- name: Install specified python requirements
# ansible.builtin.pip:
# requirements: "{{ ansible_workdir }}/requirements.txt"
# state: present
# become: yes
# when: app_dir.stat.exists == true and python_requirements is defined
- name: Include extra Nagios/NRPE task logic
include_tasks: nagios_tasks.yml