From 204686fed1f3ed0163ce2f9bc8e1dbf39d3b8831 Mon Sep 17 00:00:00 2001
From: Maarten de Waard <maarten@greenhost.nl>
Date: Mon, 25 Oct 2021 14:53:37 +0200
Subject: [PATCH] move tasks around to prevent error

---
 values-local.yaml.example                     | 22 +++++++++++++++++++
 values.yaml                                   | 11 +---------
 .../roles/wordpress-init/tasks/main.yml       | 10 ++++-----
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/values-local.yaml.example b/values-local.yaml.example
index bdc86ab..0e3e7ea 100644
--- a/values-local.yaml.example
+++ b/values-local.yaml.example
@@ -117,6 +117,28 @@ openid_connect_settings:
   role_mapping_enabled: false
   role_key: roles
 
+smtp_settings:
+  # Enable using these SMTP settings
+  enabled: false
+  # Username for SMTP authentication
+  smtp_user: admin@example.com 
+  # Password for STMP authentication
+  smtp_pass: password
+  # Hostname of the mailserver
+  smtp_host: smtp.greenhost.nl
+  # SMTP from email address
+  smtp_from: admin@example.com
+  # SMTP from name
+  smtp_name: Admin
+  # SMTP port number - likely to be 25, 465 or 587
+  smtp_port: 587
+  # Encryption system to use - ssl or tls
+  smtp_secure: 'tls'
+  # Use SMTP authentication (true|false)
+  smtp_auth: true
+  # Can be set to 1 or 2 for debug logs
+  smtp_debug: 0
+
 database:
   auth:
     username: wordpress
diff --git a/values.yaml b/values.yaml
index 65b9606..0a42e6b 100644
--- a/values.yaml
+++ b/values.yaml
@@ -189,26 +189,17 @@ service:
   type: ClusterIP
   port: 8080
 
+# See values-local.yaml.example for an explanation of these variables
 smtp_settings:
-  # Enable using these SMTP settings
   enabled: false
-  # Username for SMTP authentication
   smtp_user: admin@example.com 
-  # Password for STMP authentication
   smtp_pass: password
-  # Hostname of the mailserver
   smtp_host: smtp.greenhost.nl
-  # SMTP from email address
   smtp_from: admin@example.com
-  # SMTP from name
   smtp_name: Admin
-  # SMTP port number - likely to be 25, 465 or 587
   smtp_port: 587
-  # Encryption system to use - ssl or tls
   smtp_secure: 'tls'
-  # Use SMTP authentication (true|false)
   smtp_auth: true
-  # Can be set to 1 or 2 for debug logs
   smtp_debug: 0
 
 ## Dictionary with variables that are inserted into the wordpress-init default
diff --git a/wp-cli-docker/roles/wordpress-init/tasks/main.yml b/wp-cli-docker/roles/wordpress-init/tasks/main.yml
index 8e3102a..81dd151 100644
--- a/wp-cli-docker/roles/wordpress-init/tasks/main.yml
+++ b/wp-cli-docker/roles/wordpress-init/tasks/main.yml
@@ -179,6 +179,11 @@
 - import_tasks: redis.yml
   when: WP_REDIS_ENABLED
 
+- name: Write additional functions file
+  template:
+    src: templates/additional_functions.php
+    dest: "{{ wordpress_homedir }}/wp-includes/additional_functions.php"
+
 - name: Extend functions.php file
   lineinfile:
     path: "{{ wordpress_homedir }}/wp-includes/functions.php"
@@ -191,10 +196,5 @@
 - import_tasks: smtp.yml
   when: WP_OPENID_CONNECT_ENABLED
 
-- name: Copy additional functions file
-  template:
-    src: templates/additional_functions.php
-    dest: "{{ wordpress_homedir }}/wp-includes/additional_functions.php"
-
 - import_tasks: multilingual.yml
   when: WP_MULTILINGUAL_ENABLED
-- 
GitLab