mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-10 10:48:10 +02:00
- updated base image from openproject/community:13 to openproject/openproject:14 - added dedicated migration task (db:migrate + schema cache clear) - moved settings, ldap, and admin tasks to separate files - adjusted docker-compose template to use OPENPROJECT_WEB_SERVICE / OPENPROJECT_SEEDER_SERVICE variables - replaced postinstall.sh with precompile-assets.sh - ensured depends_on uses variable-based service names Ref: https://chatgpt.com/share/68d57770-2430-800f-ae53-e7eda6993a8d
31 lines
1.2 KiB
YAML
31 lines
1.2 KiB
YAML
- name: Ensure administrator user exists and is admin
|
|
shell: >
|
|
docker compose exec web bash -c "
|
|
cd /app &&
|
|
RAILS_ENV={{ ENVIRONMENT | lower }} bundle exec rails runner \"
|
|
u = User.find_by(login: '{{ OPENPROJECT_ADMINISTRATOR_USERNAME }}')
|
|
if u.nil?
|
|
u = User.new(
|
|
login: '{{ OPENPROJECT_ADMINISTRATOR_USERNAME }}',
|
|
mail: '{{ OPENPROJECT_ADMINISTRATOR_EMAIL }}',
|
|
firstname: 'Admin',
|
|
lastname: 'User',
|
|
password: '{{ OPENPROJECT_ADMINISTRATOR_PASSWORD }}',
|
|
password_confirmation: '{{ OPENPROJECT_ADMINISTRATOR_PASSWORD }}'
|
|
)
|
|
u.admin = true
|
|
u.save!
|
|
puts 'Administrator {{ OPENPROJECT_ADMINISTRATOR_USERNAME }} created and set as admin.'
|
|
else
|
|
u.admin = true
|
|
u.save!
|
|
puts 'User {{ OPENPROJECT_ADMINISTRATOR_USERNAME }} updated to admin.'
|
|
end
|
|
\"
|
|
"
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}"
|
|
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
|
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|