Activated auto settings for ldap and smtp

This commit is contained in:
2025-04-07 09:19:37 +02:00
parent fe39a7f701
commit 2997fb4f5f
9 changed files with 154 additions and 18 deletions

View File

@@ -0,0 +1,47 @@
- name: "Create LDAP auth source"
community.postgresql.postgresql_query:
db: openproject
login_user: postgres
query: >
INSERT INTO ldap_auth_sources
(name, host, port, account, account_password, base_dn, attr_login,
attr_firstname, attr_lastname, attr_mail, onthefly_register, attr_admin,
created_at, updated_at, tls_mode, filter_string, verify_peer, tls_certificate_string)
VALUES (
'{{ openproject_ldap.name }}',
'{{ openproject_ldap.host }}',
{{ openproject_ldap.port }},
'{{ openproject_ldap.account }}',
'{{ openproject_ldap.account_password }}',
'{{ openproject_ldap.base_dn }}',
'{{ openproject_ldap.attr_login }}',
'{{ openproject_ldap.attr_firstname }}',
'{{ openproject_ldap.attr_lastname }}',
'{{ openproject_ldap.attr_mail }}',
{{ openproject_ldap.onthefly_register }},
'{{ openproject_ldap.attr_admin }}',
NOW(),
NOW(),
{{ openproject_ldap.tls_mode }},
'{{ openproject_ldap.filter_string }}',
{{ openproject_ldap.verify_peer }},
'{{ openproject_ldap.tls_certificate_string }}'
)
ON CONFLICT (name) DO NOTHING;
become: true
vars_files:
- vars/ldap.yml
- name: "Check existing LDAP sources"
community.postgresql.postgresql_query:
db: openproject
login_user: postgres
query: "SELECT id, name FROM ldap_auth_sources"
register: ldap_entries
when: enable_debug | bool
- name: "Debug LDAP entries"
debug:
var: ldap_entries
when: enable_debug | bool

View File

@@ -44,3 +44,21 @@
- name: "copy docker-compose.yml and env file"
include_tasks: copy-docker-compose-and-env.yml
- name: flush docker service
meta: flush_handlers
- name: "Set OpenProject settings via rails"
vars:
rails_env: "RAILS_ENV=production"
rails_cmd: "bundle exec rails runner"
docker_container:
name: openproject-web
command: >
bash -c "cd /app &&
{{ rails_env }} {{ rails_cmd }} 'Setting[:{{ item.key }}] = {{ item.value | to_json }}'"
loop: "{{ openproject_settings | dict2items }}"
- name: Setup LDAP
include_tasks: ldap.yml
when: applications[application_id].ldap.enabled | bool