---
- name: "π§ Akaunting | Resolve the data volume's mountpoint on this node"
ansible.builtin.command: >-
container volume inspect --format '{{ "{{.Mountpoint}}" }}'
{{ AKAUNTING_VOLUME | quote }}
register: akaunting_volume_mountpoint
changed_when: false
- name: "π Akaunting | Check if first run (marker exists?)"
ansible.builtin.stat:
path: "{{ AKAUNTING_SETUP_MARKER }}"
register: akaunting_marker_stat
- when: not akaunting_marker_stat.stat.exists
block:
- name: "βΆοΈ Akaunting | First-run install one-shot ({{ DEPLOYMENT_MODE }})"
ansible.builtin.include_tasks:
file: "setup/{{ DEPLOYMENT_MODE }}.yml"
apply:
delegate_to: "{{ STACK_HOST }}"
- name: "π Akaunting | Create first-run marker to disable future setup"
ansible.builtin.file:
path: "{{ AKAUNTING_SETUP_MARKER }}"
state: touch
mode: "0644"
modification_time: preserve
access_time: preserve
- name: "π Akaunting | Resolve the hosting node and container id"
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
vars:
resolve_service_key: "akaunting"
resolve_output_prefix: AKAUNTING
resolve_compose_cid: "{{ AKAUNTING_CONTAINER }}"
- name: "π Akaunting | Realign the administrator password with the declared one"
ansible.builtin.command:
expand_argument_vars: false
argv:
- container
- exec
- "{{ AKAUNTING_LOCAL_CID }}" # nocheck: container-exec-resolver AKAUNTING_LOCAL_CID resolved at delegate_to runtime
- php
- artisan
- tinker
- "--execute={{ lookup('file', 'php/realign_admin_password.php') }}"
register: akaunting_admin_realign
changed_when: "'CHANGED' in akaunting_admin_realign.stdout_lines"
failed_when: akaunting_admin_realign.rc != 0
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
delegate_to: "{{ AKAUNTING_HOST_NODE }}"
run_once: true
- name: "π§ Akaunting | Report that no account carries the declared e-mail"
ansible.builtin.fail:
msg: "{{ akaunting_admin_realign.stdout }}"
when: "'FAILED' in akaunting_admin_realign.stdout"
run_once: true