---
- name: "π Deploy PHP error configuration (env aware)"
stack_host_template:
src: "php.ini.j2"
dest: "{{ SUITECRM_PHP_CONFIG_HOST }}"
notify:
- compose-up
- name: "π Render the SITE_URL of the network sibling a request arrives on"
stack_host_template:
src: "site_url.php.j2"
dest: "{{ SUITECRM_SITE_URL_SCRIPT_HOST }}"
notify:
- compose-up
- name: "π Render SuiteCRM LDAP mapping"
stack_host_template:
src: "ldap.yaml.j2"
dest: "{{ SUITECRM_LDAP_CONFIG_HOST }}"
when: SUITECRM_LDAP_ENABLED | bool
notify:
- compose-up
- name: "π Deploy SuiteCRM session handler wiring"
stack_host_copy:
src: "session.yaml"
dest: "{{ SUITECRM_SESSION_CONFIG_HOST }}"
mode: "0444"
notify:
- compose-up
- name: "π Deploy '{{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_ABS }}'"
copy:
src: "{{ SUITECRM_ENTRYPOINT_SCRIPT_SRC }}"
dest: "{{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_ABS }}"
notify:
- compose-up
- compose-build
- name: "π Deploy '{{ SUITECRM_EXTERNAL_AUTH_PATCH_HOST_ABS }}'"
copy:
src: "{{ SUITECRM_EXTERNAL_AUTH_PATCH_SRC }}"
dest: "{{ SUITECRM_EXTERNAL_AUTH_PATCH_HOST_ABS }}"
notify:
- compose-up
- compose-build
- name: "π³ Docker Compose Up for '{{ application_id }}'"
meta: flush_handlers
- name: "β³ Wait until the SuiteCRM container is healthy"
shell: >
container inspect --type container --format '{% raw %}{{.State.Health.Status}}{% endraw %}' {{ SUITECRM_CONTAINER_ADDRESS }}
register: suitecrm_health
changed_when: false
until: suitecrm_health.stdout.strip() == "healthy"
retries: 300
delay: 5
- name: "π Ensure the SuiteCRM administrator exists and accepts the declared password"
ansible.builtin.shell:
cmd: >-
container exec -i --user {{ SUITECRM_WEB_USER }}
-e SUITECRM_REALIGN_USERNAME -e SUITECRM_REALIGN_PASSWORD -e SUITECRM_REALIGN_EMAIL
{{ SUITECRM_CONTAINER_ADDRESS }} php
stdin: "{{ lookup('file', 'php/realign_admin_password.php') }}"
environment:
SUITECRM_REALIGN_USERNAME: "{{ SUITECRM_ADMIN_USERNAME }}"
SUITECRM_REALIGN_PASSWORD: "{{ SUITECRM_ADMIN_PASSWORD }}"
SUITECRM_REALIGN_EMAIL: "{{ SUITECRM_ADMIN_EMAIL }}"
register: suitecrm_admin_password_realign
changed_when: suitecrm_admin_password_realign.stdout is search('\[CHANGED\]')
failed_when: >-
suitecrm_admin_password_realign.rc != 0
or suitecrm_admin_password_realign.stdout is search('\[FAIL\]')
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: "π List SuiteCRM log paths the web user cannot write"
shell: >
container exec --user {{ SUITECRM_WEB_USER }} {{ SUITECRM_CONTAINER_ADDRESS }}
find {{ SUITECRM_APP_DIR }}/logs ! -writable
register: suitecrm_unwritable_logs
changed_when: false
failed_when: suitecrm_unwritable_logs.rc != 0 or suitecrm_unwritable_logs.stdout | length > 0