|
115 | 115 | status_code: 200
|
116 | 116 | register: flow_instances
|
117 | 117 |
|
118 |
| -- name: set_fact authorization flow |
| 118 | +- name: Set authorization flow |
119 | 119 | ansible.builtin.set_fact:
|
120 | 120 | authentik_authorization_flow_uuid: "{{ item.pk }}"
|
121 | 121 | loop: "{{ flow_instances.json.results }}"
|
122 | 122 | when: item.slug == "default-provider-authorization-implicit-consent"
|
123 | 123 |
|
| 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 | + |
124 | 130 | - name: Create Traefik Forward Auth provider
|
125 | 131 | ansible.builtin.uri:
|
126 | 132 | url: "{{ authentik_host }}/api/v3/providers/proxy/"
|
|
133 | 139 | body:
|
134 | 140 | name: "Traefik Forward Auth"
|
135 | 141 | authorization_flow: "{{ authentik_authorization_flow_uuid }}"
|
| 142 | + invalidation_flow: "{{ authentik_invalidation_flow_uuid }}" |
136 | 143 | cookie_domain: "{{ authentik_web_domain }}"
|
137 | 144 | external_host: "{{ authentik_web_url }}"
|
138 | 145 | mode: "forward_domain"
|
139 |
| - access_token_validity: "hours=24" |
| 146 | + access_token_validity: "hours={{ authentik_access_token_validity }}" |
140 | 147 | status_code: 201
|
141 | 148 | register: proxy_providers
|
142 | 149 |
|
|
182 | 189 | authentik_host: "{{ authentik_web_url }}"
|
183 | 190 | status_code: 200
|
184 | 191 |
|
| 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 | + |
185 | 228 | - name: Remove existing Docker containers
|
186 | 229 | ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"
|
187 | 230 | vars:
|
|
249 | 292 | Accept: "application/json"
|
250 | 293 | body:
|
251 | 294 | is_active: false
|
| 295 | + groups: [] |
252 | 296 | status_code: 200
|
0 commit comments