mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-04-28 10:26:54 +02:00
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
---
|
|
- name: "Include docker-discourse"
|
|
include_role:
|
|
name: docker-discourse
|
|
|
|
- name: Wait for Discourse API
|
|
wait_for:
|
|
host: "{{ domains.discourse }}"
|
|
port: 80
|
|
delay: 5
|
|
timeout: 600
|
|
|
|
- name: "Generate Discourse API Key when WP Discourse is enabled"
|
|
include_tasks: generate-api-key.yml
|
|
|
|
- name: "Load WP Discourse settings"
|
|
include_vars:
|
|
file: "{{ role_path }}/vars/discourse.yml"
|
|
|
|
- name: "Install WP Discourse plugin"
|
|
command: >
|
|
docker-compose exec -u www-data -T application
|
|
wp plugin install wp-discourse --activate
|
|
--path={{ wordpress_docker_html_path }}
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}"
|
|
|
|
- name: "Configure WP Discourse settings"
|
|
loop: "{{ discourse_settings | map(attribute='name') | unique | list }}"
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
vars:
|
|
option_name: "{{ item }}"
|
|
|
|
option_items: >-
|
|
{{ discourse_settings
|
|
| selectattr('name', 'equalto', option_name)
|
|
| list
|
|
}}
|
|
|
|
option_kv: >-
|
|
{{ dict(
|
|
option_items | map(attribute='key')
|
|
| zip(option_items | map(attribute='value'))
|
|
) }}
|
|
|
|
option_json_b64: "{{ option_kv | to_json | b64encode }}"
|
|
|
|
command: >
|
|
docker-compose exec -u www-data -T application bash -lc
|
|
"wp eval \"update_option(
|
|
'{{ option_name }}',
|
|
json_decode(
|
|
base64_decode('{{ option_json_b64 }}'),
|
|
true
|
|
)
|
|
);\" --path={{ wordpress_docker_html_path }}"
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}" |