Wrapped in block to avoid multiple similar when conditions for 7-4 web core

This commit is contained in:
Kevin Veen-Birkenbach 2025-08-08 12:25:09 +02:00
parent 14f07adc9d
commit e675aa5886
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
3 changed files with 52 additions and 56 deletions

View File

@ -1,59 +1,55 @@
--- ---
- name: Include openresty - block:
include_role: - name: Include openresty
name: svc-prx-openresty include_role:
public: false name: svc-prx-openresty
# Explicit set to guaranty that application_id will not be overwritten. public: false
# Should be anyhow the default case # Explicit set to guaranty that application_id will not be overwritten.
when: run_once_srv_web_core is not defined # Should be anyhow the default case
- name: "reset (if enabled)" - name: "reset (if enabled)"
include_tasks: reset.yml include_tasks: 01_reset.yml
when: mode_reset | bool and run_once_srv_web_core is not defined when: mode_reset | bool
- name: Ensure nginx configuration directories are present - name: Ensure nginx configuration directories are present
file: file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
owner: "{{nginx.user}}" owner: "{{nginx.user}}"
group: "{{nginx.user}}" group: "{{nginx.user}}"
mode: '0755' mode: '0755'
recurse: yes recurse: yes
loop: > loop: >
{{ {{
[ nginx.directories.configuration ] + [ nginx.directories.configuration ] +
(nginx.directories.http.values() | list) + ( nginx.directories.http.values() | list ) +
[ nginx.directories.streams ] [ nginx.directories.streams ]
}} }}
when: run_once_srv_web_core is not defined
- name: Ensure nginx data storage directories are present
- name: Ensure nginx data storage directories are present file:
file: path: "{{ item }}"
path: "{{ item }}" state: directory
state: directory recurse: yes
recurse: yes owner: "{{nginx.user}}"
owner: "{{nginx.user}}" group: "{{nginx.user}}"
group: "{{nginx.user}}" mode: '0755'
mode: '0755' loop: >
loop: > {{ nginx.directories.data.values() | list }}
{{ nginx.directories.data.values() | list }}
when: run_once_srv_web_core is not defined - name: "Include tasks to create cache directories"
include_tasks: 02_cache_directories.yml
- name: "Include tasks to create cache directories"
include_tasks: cache_directories.yml - name: create nginx config file
template:
- name: create nginx config file src: nginx.conf.j2
template: dest: "{{ nginx.files.configuration }}"
src: nginx.conf.j2 notify: restart openresty
dest: "{{ nginx.files.configuration }}"
notify: restart openresty - name: flush nginx service
when: run_once_srv_web_core is not defined meta: flush_handlers
- name: flush nginx service - name: run {{ role_name }} once
meta: flush_handlers set_fact:
when: run_once_srv_web_core is not defined run_once_srv_web_core: true
- name: run {{ role_name }} once
set_fact:
run_once_srv_web_core: true
when: run_once_srv_web_core is not defined when: run_once_srv_web_core is not defined