diff --git a/ansible/roles/authentik/tasks/build.yml b/ansible/roles/authentik/tasks/build.yml
index 128ba15..78f9780 100644
--- a/ansible/roles/authentik/tasks/build.yml
+++ b/ansible/roles/authentik/tasks/build.yml
@@ -7,26 +7,37 @@
force: true
- name: Build front
- ansible.builtin.shell: |
- cd /opt/authentik/src/website
- npm i
- npm run build-docs-only
- cd /opt/authentik/src/web
- npm i
- npm run build
+ ansible.builtin.shell:
+ executable: /bin/bash
+ cmd: |
+ export NODE_ENV=production
+ cd /opt/authentik/src/website
+ npm ci --include=dev
+ npm run build-docs-only
+ cd /opt/authentik/src/web
+ npm ci --include=dev
+ npm run build
+
+- name: Build go proxy
+ ansible.builtin.shell:
+ executable: /bin/bash
+ cmd: |
+ cd /opt/authentik/src/
+ go mod download
+ CGO_ENABLED=0 go build -o /opt/authentik/server ./cmd/server
- name: Create virtualenv
ansible.builtin.command: python3.12 -m venv /opt/authentik/src/venv
- name: Installl poetry and dependencies
- ansible.builtin.shell: |
- cd /opt/authentik/src/
- venv/bin/pip install poetry
- venv/bin/poetry install --only=main --no-ansi --no-interaction --no-root
-
-
-- name: Build go proxy
- ansible.builtin.shell: |-
- cd /opt/authentik/src/
- sed -i "s/c.Setup(\".\/authentik\/lib\/default.yml\", \".\/local.env.yml\")/c.Setup(\"\/etc\/authentik\/config.yml\", \".\/authentik\/lib\/default.yml\", \".\/local.env.yml\")/" /opt/authentik/src/internal/config/config.go
- go build -o /opt/authentik/src/authentik-server ./cmd/server/
+ ansible.builtin.shell:
+ executable: /bin/bash
+ cmd: |
+ cd /opt/authentik/src
+ source /opt/authentik/src/venv/bin/activate
+ export VENV_PATH=/opt/authentik/src/venv
+ export POETRY_VIRTUALENVS_CREATE=false
+ venv/bin/pip3 install --upgrade pip
+ venv/bin/pip3 install poetry
+ venv/bin/poetry venv use venv/python3.12
+ venv/bin/poetry install --only=main --no-ansi --no-interaction --no-root
diff --git a/ansible/roles/authentik/tasks/dependencies.yml b/ansible/roles/authentik/tasks/dependencies.yml
index b277a2d..2e449ea 100644
--- a/ansible/roles/authentik/tasks/dependencies.yml
+++ b/ansible/roles/authentik/tasks/dependencies.yml
@@ -1,9 +1,13 @@
---
- name: Install roles dependencies
ansible.builtin.apt:
+ install_recommends: false
name: "{{ item }}"
with_items:
- git
+ - build-essential
+ - pkg-config
+ - zlib1g-dev
- libpq-dev
- libxmlsec1-dev
diff --git a/ansible/roles/authentik/tasks/main.yml b/ansible/roles/authentik/tasks/main.yml
index 1020310..1447498 100644
--- a/ansible/roles/authentik/tasks/main.yml
+++ b/ansible/roles/authentik/tasks/main.yml
@@ -11,3 +11,22 @@
tags:
- build
become_user: authentik
+
+- name: Create useful directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ mode: "0755"
+ owner: authentik
+ with_items:
+ - /opt/authentik/certs
+ - /opt/authentik/media
+ - /etc/authentik
+
+- name: Test
+ ansible.builtin.copy:
+ remote_src: true
+ src: /opt/authentik/src/blueprints
+ dest: /opt/authentik/blueprints
+ owner: authentik
+ become: true