mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-08 22:28:02 +00:00
Add new Shopware 6 role with OIDC/LDAP plugin integration and Docker-based deployment configuration.
Includes: - New role: web-app-shopware (Docker, MariaDB, Redis, OpenSearch) - Updated networks and ports configuration - Automated install, migration, and admin creation - Optional IAM integration via OIDC/LDAP plugins Reference: https://chatgpt.com/share/6907b0d4-ab14-800f-b576-62c0d26c8ad1
This commit is contained in:
71
roles/web-app-shopware/tasks/main.yml
Normal file
71
roles/web-app-shopware/tasks/main.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
- name: "Load docker, DB and proxy for {{ application_id }}"
|
||||
include_role:
|
||||
name: sys-stk-full-stateful
|
||||
|
||||
- name: Wait for Shopware HTTP endpoint
|
||||
wait_for:
|
||||
host: "127.0.0.1"
|
||||
port: "{{ ports.localhost.http[application_id] }}"
|
||||
delay: 5
|
||||
timeout: 300
|
||||
|
||||
- name: Render environment and DB settings
|
||||
include_tasks: 01_database.yml
|
||||
|
||||
- name: "Run Shopware install / migrations"
|
||||
shell: |
|
||||
docker exec -i --user {{ SHOPWARE_USER }} {{ SHOPWARE_PHP_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
cd {{ SHOPWARE_ROOT }}
|
||||
php bin/console system:install --basic-setup --create-database --force
|
||||
php bin/console database:migrate --all
|
||||
php bin/console database:migrate-destructive --all
|
||||
php bin/console cache:clear
|
||||
'
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: migrate
|
||||
changed_when: migrate.rc == 0
|
||||
|
||||
- name: "Create initial admin user (idempotent)"
|
||||
shell: |
|
||||
docker exec -i --user {{ SHOPWARE_USER }} {{ SHOPWARE_PHP_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
cd {{ SHOPWARE_ROOT }}
|
||||
php bin/console user:create "{{ users.administrator.username }}" \
|
||||
--admin --password="{{ users.administrator.password }}" \
|
||||
--firstName="Admin" --lastName="User" --email="{{ users.administrator.email }}" || true
|
||||
'
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
|
||||
- name: "Warm up caches and index"
|
||||
shell: |
|
||||
docker exec -i --user {{ SHOPWARE_USER }} {{ SHOPWARE_PHP_CONTAINER }} bash -lc '
|
||||
cd {{ SHOPWARE_ROOT }}
|
||||
php bin/console messenger:consume --time-limit=60 --limit=100 || true
|
||||
php bin/console dal:refresh:index || true
|
||||
php bin/console cache:clear
|
||||
'
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
|
||||
- name: Execute setup routines (OIDC/LDAP)
|
||||
include_tasks: 02_setup.yml
|
||||
|
||||
- name: Execute cleanup routines
|
||||
include_tasks: 03_cleanup.yml
|
||||
when: MODE_CLEANUP
|
||||
|
||||
- name: Register DNS records for Shopware domain(s)
|
||||
include_role:
|
||||
name: sys-dns-cloudflare-records
|
||||
vars:
|
||||
cloudflare_records:
|
||||
- zone: "{{ domains | get_domain(application_id) | to_zone }}"
|
||||
type: A
|
||||
name: "{{ domains | get_domain(application_id) }}"
|
||||
content: "{{ networks.internet.ip4 }}"
|
||||
proxied: true
|
||||
when: DNS_PROVIDER == 'cloudflare'
|
||||
Reference in New Issue
Block a user