debug nginx fact finding
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
- name: Gather package facts
|
||||
ansible.builtin.package_facts:
|
||||
manager: auto # Automatically detects the package manager (apt, yum, dnf, etc.)
|
||||
|
||||
- name: Debug if NGINX is installed
|
||||
ansible.builtin.debug:
|
||||
msg: "NGINX is installed (version: {{ ansible_facts.packages['nginx'][0].version }})"
|
||||
when: "'nginx' in ansible_facts.packages" # Checks if 'nginx' key exists in the gathered facts
|
||||
|
||||
- name: Debug if NGINX is NOT installed
|
||||
ansible.builtin.debug:
|
||||
msg: "NGINX is not installed"
|
||||
when: "'nginx' not in ansible_facts.packages"
|
||||
|
||||
- name: Stop nginx to generate initial lego cert
|
||||
service:
|
||||
name: nginx
|
||||
state: stopped
|
||||
when: "'nginx' in ansible_facts.packages" # Checks if 'nginx' key exists in the gathered facts
|
||||
|
||||
- name: Generate initial cert
|
||||
command:
|
||||
|
||||
Reference in New Issue
Block a user