boma/roles/netbird_coordinator/tasks/main.yml
sjat 8f1c7d47ec fix(reverse_proxy,netbird_coordinator): create scaffold dirs in check mode
Add check_mode: false to the state:directory base_dir tasks so that 'make check'
on a brand-new compose service role creates the scaffold during --check and the
rest of the dry-run (templates + docker_compose_v2 up) can be evaluated instead
of failing on a missing project_src. The directive is inert under a normal
converge (incl. Molecule + its tagged second converge), so role tests are
unchanged. Consumes the 2026-06-16 signal in docs/FRICTION.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:49:47 +02:00

40 lines
1.2 KiB
YAML

---
- name: Ensure the service directory exists
ansible.builtin.file:
path: "{{ netbird_coordinator__base_dir }}"
state: directory
mode: "0750"
# create the scaffold even in --check so dry-run can evaluate templates + compose (idempotent mkdir)
check_mode: false
tags: [config]
- name: Render the combined server config
ansible.builtin.template:
src: config.yaml.j2
dest: "{{ netbird_coordinator__base_dir }}/config.yaml"
mode: "0640"
no_log: true # holds authSecret + datastore encryption key
notify: restart netbird
tags: [config]
- name: Render the dashboard env file
ansible.builtin.template:
src: dashboard.env.j2
dest: "{{ netbird_coordinator__base_dir }}/dashboard.env"
mode: "0644"
notify: restart netbird
tags: [config]
- name: Render the compose file
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ netbird_coordinator__base_dir }}/docker-compose.yml"
mode: "0644"
tags: [config]
- name: Bring the NetBird coordinator up
community.docker.docker_compose_v2:
project_src: "{{ netbird_coordinator__base_dir }}"
state: present
when: netbird_coordinator__manage | bool
tags: [deploy]