diff --git a/roles/sys-ctl-cln-faild-bkps/vars/main.yml b/roles/sys-ctl-cln-faild-bkps/vars/main.yml index 1572a4ad..96606240 100644 --- a/roles/sys-ctl-cln-faild-bkps/vars/main.yml +++ b/roles/sys-ctl-cln-faild-bkps/vars/main.yml @@ -1,2 +1,2 @@ -system_service_id: sys-ctl-cln-faild-bkps -CLN_FAILED_DOCKER_BACKUPS_PKG: cleanup-failed-docker-backups +system_service_id: sys-ctl-cln-faild-bkps +CLN_FAILED_DOCKER_BACKUPS_PKG: cleanup-failed-docker-backups diff --git a/roles/web-app-discourse/tasks/03_docker.yml b/roles/web-app-discourse/tasks/03_docker.yml index 0c6dd3cb..14faf68e 100644 --- a/roles/web-app-discourse/tasks/03_docker.yml +++ b/roles/web-app-discourse/tasks/03_docker.yml @@ -19,7 +19,7 @@ become: true ignore_errors: true -- name: set chmod 700 for '{{ DISCOURSE_CONTAINERS_DIR}}' +- name: set chmod 700 for '{{ DISCOURSE_CONTAINERS_DIR }}' ansible.builtin.file: path: "{{ DISCOURSE_CONTAINERS_DIR }}" mode: '700' diff --git a/roles/web-app-discourse/vars/main.yml b/roles/web-app-discourse/vars/main.yml index eb35ef0e..29641014 100644 --- a/roles/web-app-discourse/vars/main.yml +++ b/roles/web-app-discourse/vars/main.yml @@ -17,10 +17,10 @@ DISCOURSE_REPOSITORY_URL: "{{ applications | get_app_conf(application_id, ## Directories DISCOURSE_REPOSITORY_DIR: "{{ docker_compose.directories.services }}{{ applications | get_app_conf( application_id, 'repository') }}/" -DISCOURSE_CONTAINERS_DIR: "{{ DISCOURSE_REPOSITORY_DIR }}/containers/" +DISCOURSE_CONTAINERS_DIR: "{{ [ DISCOURSE_REPOSITORY_DIR, 'containers' ] | path_join }}" ## Files -DISCOURSE_APPLICATION_YML_DEST: "{{ DISCOURSE_CONTAINERS_DIR }}{{ DISCOURSE_CONTAINER }}.yml" +DISCOURSE_APPLICATION_YML_DEST: "{{ [ DISCOURSE_CONTAINERS_DIR, DISCOURSE_CONTAINER ~ '.yml' ] | path_join }}" ## Error Strings DISCOURSE_ERROR_ALREADY_IN_NET: "Error response from daemon: endpoint with name {{ DISCOURSE_CONTAINER }} already exists in network {{ DISCOURSE_PG_NETWORK }}" diff --git a/roles/web-app-nextcloud/tasks/07_plugin_enable_and_configure.yml b/roles/web-app-nextcloud/tasks/07_plugin_enable_and_configure.yml index 13f39ca6..35323646 100644 --- a/roles/web-app-nextcloud/tasks/07_plugin_enable_and_configure.yml +++ b/roles/web-app-nextcloud/tasks/07_plugin_enable_and_configure.yml @@ -1,18 +1,18 @@ -- name: enable {{plugin_key}} nextcloud plugin - command: "{{NEXTCLOUD_DOCKER_EXEC_OCC}} app:enable {{plugin_key}}" +- name: enable {{ plugin_key }} nextcloud plugin + command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:enable {{ plugin_key }}" register: enable_result changed_when: enable_result.rc == 0 and ("already enabled" not in enable_result.stdout) -- name: Check if {{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml exists +- name: Check if {{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml exists stat: - path: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml" + path: "{{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml" delegate_to: localhost become: false register: plugin_vars_file - name: "Load {{ plugin_key }} configuration variables" include_vars: - file: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml" + file: "{{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml" when: plugin_vars_file.stat.exists - name: "Set plugin configuration (batched shell, no async)" @@ -35,13 +35,13 @@ async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}" poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}" -- name: Check if {{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml exists +- name: Check if {{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml exists stat: - path: "{{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml" + path: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml" delegate_to: localhost become: false register: plugin_tasks_file -- name: "include {{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml" - include_tasks: "{{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml" +- name: "include {{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml" + include_tasks: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml" when: plugin_tasks_file.stat.exists \ No newline at end of file diff --git a/roles/web-app-wordpress/tasks/02_install.yml b/roles/web-app-wordpress/tasks/02_install.yml index 111862b4..fd177c86 100644 --- a/roles/web-app-wordpress/tasks/02_install.yml +++ b/roles/web-app-wordpress/tasks/02_install.yml @@ -3,7 +3,7 @@ command: > docker exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER }} wp core install - --url="{{ domains | get_url(application_id, WEB_PROTOCOL) }}" + --url="{{ WORDPRESS_URL }}" --title="{{ applications | get_app_conf(application_id, 'title', True) }}" --admin_user="{{ applications | get_app_conf(application_id, 'users.administrator.username') }}" --admin_password="{{ applications | get_app_conf(application_id, 'credentials.administrator_password', True) }}" diff --git a/roles/web-app-wordpress/tasks/03_enable_plugin.yml b/roles/web-app-wordpress/tasks/03_enable_plugin.yml index 79ad387a..41f55299 100644 --- a/roles/web-app-wordpress/tasks/03_enable_plugin.yml +++ b/roles/web-app-wordpress/tasks/03_enable_plugin.yml @@ -1,8 +1,10 @@ --- -- name: "Check if plugin has a dedicated install task" +- name: "Check if plugin has a dedicated install task under '{{ plugin_task_path }}'" stat: path: "{{ plugin_task_path }}" register: plugin_task_file + delegate_to: localhost + become: false - name: "Include plugin-specific install task if it exists" include_tasks: "{{ plugin_task_path }}" diff --git a/roles/web-app-wordpress/tasks/main.yml b/roles/web-app-wordpress/tasks/main.yml index 104420f5..4a89dbaf 100644 --- a/roles/web-app-wordpress/tasks/main.yml +++ b/roles/web-app-wordpress/tasks/main.yml @@ -15,16 +15,18 @@ vars: docker_compose_flush_handlers: false -- name: "Transfering upload.ini to {{ docker_compose.directories.instance }}" +- name: "Transfering upload.ini to {{ WORDPRESS_CONFIG_UPLD_ABS }}" template: src: upload.ini.j2 - dest: "{{ docker_compose.directories.instance }}upload.ini" - notify: docker compose up + dest: "{{ WORDPRESS_CONFIG_UPLD_ABS }}" + notify: + - docker compose up + - docker compose build -- name: "Transfering msmtprc to {{ WORDPRESS_HOST_MSMTP_CONF }}" +- name: "Transfering msmtprc to {{ WORDPRESS_MSMTP_ABS }}" template: - src: "{{ playbook_dir }}/roles/sys-svc-msmtp/templates/msmtprc.conf.j2" - dest: "{{ WORDPRESS_HOST_MSMTP_CONF }}" + src: "{{ WORDPRESS_MSMTP_SRC }}" + dest: "{{ WORDPRESS_MSMTP_ABS }}" notify: docker compose up - name: Flush handlers to make {{ WORDPRESS_CONFIG_FILE }} available before patch @@ -53,7 +55,7 @@ vars: plugin_name: "{{ item.key }}" plugin_enabled: "{{ item.value.enabled | bool }}" - plugin_task_path: "{{ role_path }}/tasks/plugins/{{ plugin_name }}/install.yml" + plugin_task_path: "{{ [role_path, 'tasks/plugins', plugin_name ~ '.yml' ] | path_join }}" when: plugin_enabled - name: Detect if WordPress is Multisite @@ -68,5 +70,5 @@ when: (wp_is_multisite.stdout | trim) == '0' vars: # Target URL to switch to (uses your helper) - wp_new_url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}" + wp_new_url: "{{ WORDPRESS_URL }}" diff --git a/roles/web-app-wordpress/templates/Dockerfile.j2 b/roles/web-app-wordpress/templates/Dockerfile.j2 index 0ea40a72..4c0dbda5 100644 --- a/roles/web-app-wordpress/templates/Dockerfile.j2 +++ b/roles/web-app-wordpress/templates/Dockerfile.j2 @@ -11,4 +11,4 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli mv wp-cli.phar /usr/local/bin/wp # Copy PHP upload settings -COPY upload.ini $PHP_INI_DIR/conf.d/ \ No newline at end of file +COPY {{ WORDPRESS_CONFIG_UPLD_REL }} $PHP_INI_DIR/conf.d/ \ No newline at end of file diff --git a/roles/web-app-wordpress/templates/docker-compose.yml.j2 b/roles/web-app-wordpress/templates/docker-compose.yml.j2 index 0c9d44f2..97b5e6e5 100644 --- a/roles/web-app-wordpress/templates/docker-compose.yml.j2 +++ b/roles/web-app-wordpress/templates/docker-compose.yml.j2 @@ -10,7 +10,7 @@ - "127.0.0.1:{{ ports.localhost.http[application_id] }}:80" volumes: - data:{{ WORDPRESS_DOCKER_HTML_PATH }} - - {{ WORDPRESS_HOST_MSMTP_CONF }}:/etc/msmtprc + - {{ WORDPRESS_MSMTP_ABS }}:/etc/msmtprc {% include 'roles/docker-container/templates/healthcheck/msmtp_curl.yml.j2' %} {% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %} diff --git a/roles/web-app-wordpress/vars/main.yml b/roles/web-app-wordpress/vars/main.yml index b1fa7594..9be34723 100644 --- a/roles/web-app-wordpress/vars/main.yml +++ b/roles/web-app-wordpress/vars/main.yml @@ -2,18 +2,22 @@ application_id: "web-app-wordpress" database_type: "mariadb" -# WordPress Specific -WORDPRESS_HOST_MSMTP_CONF: "{{ [ docker_compose.directories.config, 'msmtprc.conf'] | path_join }}" -WORDPRESS_MAX_UPLOAD_SIZE: "{{ applications | get_app_conf(application_id, 'max_upload_size') }}" -WORDPRESS_CUSTOM_IMAGE: "wordpress_custom" -WORDPRESS_DOCKER_HTML_PATH: "/var/www/html" -WORDPRESS_DOCKER_CONF_PATH: "{{ WORDPRESS_CONFIG_PATH }}" -WORDPRESS_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.version') }}" -WORDPRESS_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.image') }}" -WORDPRESS_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.name') }}" -WORDPRESS_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}" -WORDPRESS_DOMAINS: "{{ applications | get_app_conf(application_id, 'server.domains.canonical') }}" -WORDPRESS_PLUGINS: "{{ applications | get_app_conf(application_id, 'plugins') | dict2items }}" -WORDPRESS_USER: "www-data" -WORDPRESS_CONFIG_FILE: "wp-config.php" -WORDPRESS_CONFIG_PATH: "{{ [WORDPRESS_DOCKER_HTML_PATH, WORDPRESS_CONFIG_FILE] | path_join }}" \ No newline at end of file +# WordPress +WORDPRESS_URL: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}" +WORDPRESS_MSMTP_SRC: "{{ [ playbook_dir, 'roles/sys-svc-msmtp/templates/msmtprc.conf.j2' ] | path_join }}" +WORDPRESS_MSMTP_ABS: "{{ [ docker_compose.directories.config, 'msmtprc.conf'] | path_join }}" +WORDPRESS_MAX_UPLOAD_SIZE: "{{ applications | get_app_conf(application_id, 'max_upload_size') }}" +WORDPRESS_CUSTOM_IMAGE: "wordpress_custom" +WORDPRESS_DOCKER_HTML_PATH: "/var/www/html" +WORDPRESS_DOCKER_CONF_PATH: "{{ WORDPRESS_CONFIG_PATH }}" +WORDPRESS_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.version') }}" +WORDPRESS_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.image') }}" +WORDPRESS_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.name') }}" +WORDPRESS_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}" +WORDPRESS_DOMAINS: "{{ applications | get_app_conf(application_id, 'server.domains.canonical') }}" +WORDPRESS_PLUGINS: "{{ applications | get_app_conf(application_id, 'plugins') | dict2items }}" +WORDPRESS_USER: "www-data" +WORDPRESS_CONFIG_FILE: "wp-config.php" +WORDPRESS_CONFIG_PATH: "{{ [WORDPRESS_DOCKER_HTML_PATH, WORDPRESS_CONFIG_FILE] | path_join }}" +WORDPRESS_CONFIG_UPLD_REL: "config/upload.ini" +WORDPRESS_CONFIG_UPLD_ABS: "{{ [docker_compose.directories.instance, WORDPRESS_CONFIG_UPLD_REL ] | path_join }}" \ No newline at end of file diff --git a/roles/web-app-wordpress/vars/oidc.yml b/roles/web-app-wordpress/vars/oidc.yml index 5353903a..f8970480 100644 --- a/roles/web-app-wordpress/vars/oidc.yml +++ b/roles/web-app-wordpress/vars/oidc.yml @@ -1,4 +1,3 @@ -# vars/oidc.yml # Defines OIDC settings for the OpenID Connect Generic plugin, with explanatory comments. # @see https://github.com/oidc-wp/openid-connect-generic/blob/develop/includes/openid-connect-dev-option-settings.php