Skip to content

Commit 57e500e

Browse files
committed
Bump to 2024.10.0 and assign admins group to notifications on new installs
1 parent 931c78e commit 57e500e

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

roles/authentik/defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ authentik_email_tls: "false"
2525
authentik_email_ssl: "false"
2626
authentik_email_timeout: "10"
2727
authentik_email_from: "authentik@localhost"
28+
authentik_access_token_validity: "24" # Hours
2829

2930
################################
3031
# Postgres
@@ -94,7 +95,7 @@ authentik_docker_container: "{{ authentik_name }}"
9495

9596
# Image
9697
authentik_docker_image_pull: true
97-
authentik_docker_image_tag: "2024.8.3"
98+
authentik_docker_image_tag: "2024.10.0"
9899
authentik_docker_image: "ghcr.io/goauthentik/server:{{ authentik_docker_image_tag }}"
99100

100101
# Ports

roles/authentik/tasks/subtasks/setup.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,18 @@
115115
status_code: 200
116116
register: flow_instances
117117

118-
- name: set_fact authorization flow
118+
- name: Set authorization flow
119119
ansible.builtin.set_fact:
120120
authentik_authorization_flow_uuid: "{{ item.pk }}"
121121
loop: "{{ flow_instances.json.results }}"
122122
when: item.slug == "default-provider-authorization-implicit-consent"
123123

124+
- name: Set invalidation flow
125+
ansible.builtin.set_fact:
126+
authentik_invalidation_flow_uuid: "{{ item.pk }}"
127+
loop: "{{ flow_instances.json.results }}"
128+
when: item.slug == "default-provider-invalidation-flow"
129+
124130
- name: Create Traefik Forward Auth provider
125131
ansible.builtin.uri:
126132
url: "{{ authentik_host }}/api/v3/providers/proxy/"
@@ -133,10 +139,11 @@
133139
body:
134140
name: "Traefik Forward Auth"
135141
authorization_flow: "{{ authentik_authorization_flow_uuid }}"
142+
invalidation_flow: "{{ authentik_invalidation_flow_uuid }}"
136143
cookie_domain: "{{ authentik_web_domain }}"
137144
external_host: "{{ authentik_web_url }}"
138145
mode: "forward_domain"
139-
access_token_validity: "hours=24"
146+
access_token_validity: "hours={{ authentik_access_token_validity }}"
140147
status_code: 201
141148
register: proxy_providers
142149

@@ -182,6 +189,42 @@
182189
authentik_host: "{{ authentik_web_url }}"
183190
status_code: 200
184191

192+
- name: Get admins group ID
193+
ansible.builtin.uri:
194+
url: "{{ authentik_host }}/api/v3/core/groups/?name=admins"
195+
method: GET
196+
headers:
197+
Authorization: "Bearer {{ authentik_admin_token }}"
198+
Content-Type: "application/json"
199+
Accept: "application/json"
200+
status_code: 200
201+
register: admin_group_response
202+
203+
- name: Get all notification rules
204+
ansible.builtin.uri:
205+
url: "{{ authentik_host }}/api/v3/events/rules/"
206+
method: GET
207+
headers:
208+
Authorization: "Bearer {{ authentik_admin_token }}"
209+
Content-Type: "application/json"
210+
Accept: "application/json"
211+
status_code: 200
212+
register: notification_rules
213+
214+
- name: Update notification rules with admins group
215+
ansible.builtin.uri:
216+
url: "{{ authentik_host }}/api/v3/events/rules/{{ item.pk }}/"
217+
method: PATCH
218+
body_format: json
219+
headers:
220+
Authorization: "Bearer {{ authentik_admin_token }}"
221+
Content-Type: "application/json"
222+
Accept: "application/json"
223+
body:
224+
group: "{{ admin_group_response.json.results[0].pk }}"
225+
status_code: 200
226+
loop: "{{ notification_rules.json.results }}"
227+
185228
- name: Remove existing Docker containers
186229
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"
187230
vars:
@@ -249,4 +292,5 @@
249292
Accept: "application/json"
250293
body:
251294
is_active: false
295+
groups: []
252296
status_code: 200

0 commit comments

Comments
 (0)