mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-20 15:21:10 +02:00
Implemented friendica database credentials update (untested)
This commit is contained in:
parent
8ccfb1dfbe
commit
45d9da3125
@ -49,7 +49,7 @@ ports:
|
|||||||
web-app-akaunting: 8025
|
web-app-akaunting: 8025
|
||||||
web-app-moodle: 8026
|
web-app-moodle: 8026
|
||||||
taiga: 8027
|
taiga: 8027
|
||||||
friendica: 8028
|
web-app-friendica: 8028
|
||||||
web-app-port-ui: 8029
|
web-app-port-ui: 8029
|
||||||
bluesky_api: 8030
|
bluesky_api: 8030
|
||||||
bluesky_web: 8031
|
bluesky_web: 8031
|
||||||
|
@ -18,7 +18,7 @@ defaults_networks:
|
|||||||
subnet: 192.168.101.48/28
|
subnet: 192.168.101.48/28
|
||||||
bluesky:
|
bluesky:
|
||||||
subnet: 192.168.101.64/28
|
subnet: 192.168.101.64/28
|
||||||
friendica:
|
web-app-friendica:
|
||||||
subnet: 192.168.101.80/28
|
subnet: 192.168.101.80/28
|
||||||
funkwhale:
|
funkwhale:
|
||||||
subnet: 192.168.101.96/28
|
subnet: 192.168.101.96/28
|
||||||
|
9
roles/web-app-friendica/tasks/01_ldap.yml
Normal file
9
roles/web-app-friendica/tasks/01_ldap.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- name: "create {{ friendica_host_ldap_config }}"
|
||||||
|
template:
|
||||||
|
src: "ldapauth.config.php.j2"
|
||||||
|
dest: "{{ friendica_host_ldap_config }}"
|
||||||
|
mode: '644'
|
||||||
|
owner: root
|
||||||
|
group: 33
|
||||||
|
force: yes
|
||||||
|
notify: docker compose up
|
34
roles/web-app-friendica/tasks/02_database.yml
Normal file
34
roles/web-app-friendica/tasks/02_database.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
- name: flush handlers to ensure that friendica is up before friendica addon configuration
|
||||||
|
meta: flush_handlers
|
||||||
|
- name: Check if Friendica local.config.php exists
|
||||||
|
command: docker exec --user {{ friendica_user }} {{ friendica_container }} test -f {{ friendica_config_file }}
|
||||||
|
register: friendica_config_exists
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Patch Friendica local.config.php with updated DB credentials
|
||||||
|
when: friendica_config_exists.rc == 0
|
||||||
|
block:
|
||||||
|
- name: Update DB host
|
||||||
|
command: >
|
||||||
|
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
||||||
|
sed -i "s/'hostname' => .*/'hostname' => '{{ database_host }}:{{ database_port }}',/" {{ friendica_config_file }}
|
||||||
|
notify: docker compose up
|
||||||
|
|
||||||
|
- name: Update DB name
|
||||||
|
command: >
|
||||||
|
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
||||||
|
sed -i "s/'database' => .*/'database' => '{{ database_name }}',/" {{ friendica_config_file }}
|
||||||
|
notify: docker compose up
|
||||||
|
|
||||||
|
- name: Update DB user
|
||||||
|
command: >
|
||||||
|
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
||||||
|
sed -i "s/'username' => .*/'username' => '{{ database_username }}',/" {{ friendica_config_file }}
|
||||||
|
notify: docker compose up
|
||||||
|
|
||||||
|
- name: Update DB password
|
||||||
|
command: >
|
||||||
|
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
||||||
|
sed -i "s/'password' => .*/'password' => '{{ database_password }}',/" {{ friendica_config_file }}
|
||||||
|
notify: docker compose up
|
35
roles/web-app-friendica/tasks/03_addons.yml
Normal file
35
roles/web-app-friendica/tasks/03_addons.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
- name: flush handlers to ensure that friendica is up before friendica addon configuration
|
||||||
|
meta: flush_handlers
|
||||||
|
|
||||||
|
- name: Build friendica_addons based on features
|
||||||
|
set_fact:
|
||||||
|
friendica_addons: >-
|
||||||
|
{{
|
||||||
|
friendica_addons | default([])
|
||||||
|
+ [{
|
||||||
|
'name': item.key,
|
||||||
|
'enabled': (
|
||||||
|
applications | get_app_conf(application_id, 'features.oidc', True)
|
||||||
|
if item.key == 'keycloakpassword'
|
||||||
|
else applications | get_app_conf(application_id, 'features.ldap', True)
|
||||||
|
if item.key == 'ldapauth'
|
||||||
|
else (item.value.enabled if item.value is mapping and 'enabled' in item.value else False)
|
||||||
|
)
|
||||||
|
}]
|
||||||
|
}}
|
||||||
|
loop: "{{ applications | get_app_conf(application_id, 'addons', True) | dict2items }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
|
||||||
|
- name: Ensure Friendica addons are in sync
|
||||||
|
command: >
|
||||||
|
docker compose exec --user {{ friendica_user }}
|
||||||
|
application
|
||||||
|
bin/console addon
|
||||||
|
{{ 'enable' if item.enabled else 'disable' }}
|
||||||
|
{{ item.name }}
|
||||||
|
args:
|
||||||
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
|
loop: "{{ friendica_addons }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
@ -3,50 +3,12 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: cmp-db-docker-proxy
|
name: cmp-db-docker-proxy
|
||||||
|
|
||||||
- name: "create {{ friendica_host_ldap_config }}"
|
- name: Integrate LDAP
|
||||||
template:
|
include_tasks: 01_ldap.yml
|
||||||
src: "ldapauth.config.php.j2"
|
|
||||||
dest: "{{ friendica_host_ldap_config }}"
|
|
||||||
mode: '644'
|
|
||||||
owner: root
|
|
||||||
group: 33
|
|
||||||
force: yes
|
|
||||||
notify: docker compose up
|
|
||||||
when: applications | get_app_conf(application_id, 'features.ldap', False)
|
when: applications | get_app_conf(application_id, 'features.ldap', False)
|
||||||
|
|
||||||
- name: Build friendica_addons based on features
|
- name: Update Friendica DB credentials
|
||||||
set_fact:
|
include_tasks: 02_database.yml
|
||||||
friendica_addons: >-
|
|
||||||
{{
|
|
||||||
friendica_addons | default([])
|
|
||||||
+ [{
|
|
||||||
'name': item.key,
|
|
||||||
'enabled': (
|
|
||||||
applications | get_app_conf(application_id, 'features.oidc', True)
|
|
||||||
if item.key == 'keycloakpassword'
|
|
||||||
else applications | get_app_conf(application_id, 'features.ldap', True)
|
|
||||||
if item.key == 'ldapauth'
|
|
||||||
else (item.value.enabled if item.value is mapping and 'enabled' in item.value else False)
|
|
||||||
)
|
|
||||||
}]
|
|
||||||
}}
|
|
||||||
loop: "{{ applications | get_app_conf(application_id, 'addons', True) | dict2items }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.key }}"
|
|
||||||
|
|
||||||
- name: flush handlers to ensure that friendica is up before friendica addon configuration
|
|
||||||
meta: flush_handlers
|
|
||||||
|
|
||||||
- name: Ensure Friendica addons are in sync
|
|
||||||
command: >
|
|
||||||
docker compose exec --user www-data
|
|
||||||
application
|
|
||||||
bin/console addon
|
|
||||||
{{ 'enable' if item.enabled else 'disable' }}
|
|
||||||
{{ item.name }}
|
|
||||||
args:
|
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
|
||||||
loop: "{{ friendica_addons }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.name }}"
|
|
||||||
|
|
||||||
|
- name: Add Friendica Add Ons
|
||||||
|
include_tasks: 03_addons.yml
|
@ -1,8 +1,11 @@
|
|||||||
application_id: "friendica"
|
application_id: "web-app-friendica"
|
||||||
database_type: "mariadb"
|
database_type: "mariadb"
|
||||||
|
friendica_container: "application"
|
||||||
friendica_no_validation: "{{ applications | get_app_conf(application_id, 'features.oidc', True) }}" # Email validation is not neccessary if OIDC is active
|
friendica_no_validation: "{{ applications | get_app_conf(application_id, 'features.oidc', True) }}" # Email validation is not neccessary if OIDC is active
|
||||||
friendica_application_base: "/var/www/html"
|
friendica_application_base: "/var/www/html"
|
||||||
friendica_docker_ldap_config: "{{friendica_application_base}}/config/ldapauth.config.php"
|
friendica_docker_ldap_config: "{{friendica_application_base}}/config/ldapauth.config.php"
|
||||||
friendica_host_ldap_config: "{{ docker_compose.directories.volumes }}ldapauth.config.php"
|
friendica_host_ldap_config: "{{ docker_compose.directories.volumes }}ldapauth.config.php"
|
||||||
|
friendica_config_dir: "{{ friendica_application_base }}/config"
|
||||||
|
friendica_config_file: "{{ friendica_config_dir }}/local.config.php"
|
||||||
|
friendica_user: "www-data"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user