2026-01-13 10:43:16 +01:00
|
|
|
---
|
|
|
|
|
# Configure Authentik flows (recovery, invitation)
|
|
|
|
|
|
|
|
|
|
- name: Use bootstrap token for API access
|
|
|
|
|
set_fact:
|
|
|
|
|
authentik_api_token: "{{ client_secrets.authentik_bootstrap_token }}"
|
|
|
|
|
|
|
|
|
|
- name: Copy recovery flow script to server
|
|
|
|
|
copy:
|
|
|
|
|
src: create_recovery_flow.py
|
|
|
|
|
dest: /tmp/create_recovery_flow.py
|
|
|
|
|
mode: '0755'
|
|
|
|
|
|
|
|
|
|
- name: Copy invitation flow script to server
|
|
|
|
|
copy:
|
|
|
|
|
src: create_invitation_flow.py
|
|
|
|
|
dest: /tmp/create_invitation_flow.py
|
|
|
|
|
mode: '0755'
|
|
|
|
|
|
2026-01-13 10:55:14 +01:00
|
|
|
- name: Copy flow scripts into container
|
|
|
|
|
shell: |
|
|
|
|
|
docker cp /tmp/create_recovery_flow.py authentik-server:/tmp/
|
|
|
|
|
docker cp /tmp/create_invitation_flow.py authentik-server:/tmp/
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
2026-01-13 10:43:16 +01:00
|
|
|
- name: Create/verify recovery flow
|
|
|
|
|
shell: |
|
|
|
|
|
docker exec -i authentik-server python3 /tmp/create_recovery_flow.py \
|
|
|
|
|
"http://localhost:9000" \
|
|
|
|
|
"{{ authentik_api_token }}"
|
|
|
|
|
register: recovery_flow
|
|
|
|
|
changed_when: "'already exists' not in recovery_flow.stdout"
|
2026-01-13 11:26:15 +01:00
|
|
|
failed_when: false
|
|
|
|
|
ignore_errors: true
|
2026-01-13 10:43:16 +01:00
|
|
|
|
|
|
|
|
- name: Create/verify invitation flow
|
|
|
|
|
shell: |
|
|
|
|
|
docker exec -i authentik-server python3 /tmp/create_invitation_flow.py \
|
|
|
|
|
"http://localhost:9000" \
|
|
|
|
|
"{{ authentik_api_token }}"
|
|
|
|
|
register: invitation_flow
|
|
|
|
|
changed_when: "'already exists' not in invitation_flow.stdout"
|
2026-01-13 12:36:08 +01:00
|
|
|
failed_when: false
|
|
|
|
|
ignore_errors: true
|
2026-01-13 10:43:16 +01:00
|
|
|
|
|
|
|
|
- name: Cleanup flow scripts from host
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
state: absent
|
|
|
|
|
loop:
|
|
|
|
|
- /tmp/create_recovery_flow.py
|
|
|
|
|
- /tmp/create_invitation_flow.py
|
|
|
|
|
|
|
|
|
|
- name: Display flows configuration status
|
|
|
|
|
debug:
|
|
|
|
|
msg: |
|
|
|
|
|
========================================
|
|
|
|
|
Authentik Flows Configuration
|
|
|
|
|
========================================
|
|
|
|
|
|
|
|
|
|
✓ Recovery Flow: Configured
|
|
|
|
|
Users can reset passwords via email
|
|
|
|
|
|
|
|
|
|
✓ Invitation Flow: Configured
|
|
|
|
|
Admins can invite users via email
|
|
|
|
|
|
|
|
|
|
Email configuration is active and flows
|
|
|
|
|
will send emails via Mailgun SMTP.
|
|
|
|
|
========================================
|