00_core.ymlΒΆ

---
- include_tasks: utils/once/flag.yml

- name: "βœ… Ensure the full openresty config tree exists before any http-include writer"
  directory_batch:
    entries: >-
      {{ lookup('nginx','directories.ensure') + [
           {'path': lookup('nginx','directories.data.well_known'), 'mode': '0755'},
           {'path': LETSENCRYPT_WEBROOT_PATH, 'mode': '0755'},
           {'path': LETSENCRYPT_BASE_PATH, 'mode': '0755'},
           {'path': TLS_SELFSIGNED_BASE_PATH, 'mode': '0755'},
         ] }}

- name: πŸ”Ž Stat the nginx.conf path
  ansible.builtin.stat:
    path: "{{ lookup('nginx','files.configuration') }}"
  register: _openresty_conf_stat

- name: πŸ—‘οΈ Drop nginx.conf if a bind-mount created it as a directory
  ansible.builtin.file:
    path: "{{ lookup('nginx','files.configuration') }}"
    state: absent
  when: _openresty_conf_stat.stat.exists and _openresty_conf_stat.stat.isdir

- name: βœ… Ensure base nginx.conf exists (bootstrap)
  ansible.builtin.copy:
    dest: "{{ lookup('nginx','files.configuration') }}"
    force: false
    mode: "0644"
    content: |
      events {}
      http { server { listen 8080; return 200; } }

- name: "πŸ”§ Setup container network for {{ application_id }}"
  include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/network/routine.yml') }}"
  vars:
    compose_handlers_flush: true

- name: "βœ… Verify that '{{ role_name }}' works"
  include_tasks: 01_assert.yml
  when: MODE_ASSERT_LOCAL | bool

- include_tasks: utils/once/flag.yml