From 2c40290f7710db5a475ac7cf6191212dc1b1ec4d Mon Sep 17 00:00:00 2001 From: Omar Tuffaha Date: Thu, 12 Dec 2019 15:13:00 +0100 Subject: [PATCH 1/7] Adhoc adding sso and sap credentials so it can be put from the main.yml and inserted in projects --- defaults/main.yml | 7 +++++++ templates/etc/env.php.j2 | 28 +++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index d6a873d..2047b03 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -302,3 +302,10 @@ magento_clones_cleanup_min_age: "1d" ## by default indexer will run only in case database was created from scratch. ## In case you need to refresh indexes on deploy (e.g. to fill search index) - set this to true. magento_force_reindex_on_deploy: False + +## Set SAP Credentials +magento_sap_oauth_credentials: false + + +## Set SSO Credentials +magento_sso_oauth_credentials: false \ No newline at end of file diff --git a/templates/etc/env.php.j2 b/templates/etc/env.php.j2 index 77b29b2..75a8b4f 100644 --- a/templates/etc/env.php.j2 +++ b/templates/etc/env.php.j2 @@ -130,6 +130,32 @@ return array ( {% if magento_run_message_queue_consumers_separately %} 'cron_consumers_runner' => array( 'cron_run' => false - ) + ), + {% endif %} + {% if magento_queue_amqp is defined%} + {% if magento_sso_oauth_credentials %} + 'websso_oauth' => + array ( + 'domain' => '{{ magento_sso_oauth_credentials.domain }}', + 'client_id' => '{{ magento_sso_oauth_credentials.client_id }}', + 'client_secret' => '{{ magento_sso_oauth_credentials.client_secret }}', + ), + {% endif %} + {% if magento_sap_oauth_credentials %} + 'sap_api' => + array ( + 'connection' => + array ( + 'username' => '{{ magento_sap_oauth_credentials.connection.username }}', + 'password' => '{{ magento_sap_oauth_credentials.connection.password }}' + ), + 'uri' => + array ( + 'availability' => '{{ magento_sap_oauth_credentials.uri.availability }}', + 'order_history' => '{{ magento_sap_oauth_credentials.uri.order_history }}', + 'order_simulate' => '{{ magento_sap_oauth_credentials.uri.order_simulate }}', + ), + ) + {% endif %} {% endif %} ); From 6f883d23172d75f0a4caf5323439458b52a5de82 Mon Sep 17 00:00:00 2001 From: Omar Tuffaha Date: Mon, 16 Dec 2019 12:29:24 +0100 Subject: [PATCH 2/7] adhoc replaced sap credentials since sap credentials is only available in some projects it was replaced to magento_additional_configuration which will contain any extra configuration like sap credentials --- defaults/main.yml | 13 ++++++++----- templates/etc/env.php.j2 | 35 ++++++++++------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 2047b03..f6735c2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -303,9 +303,12 @@ magento_clones_cleanup_min_age: "1d" ## In case you need to refresh indexes on deploy (e.g. to fill search index) - set this to true. magento_force_reindex_on_deploy: False -## Set SAP Credentials -magento_sap_oauth_credentials: false - - ## Set SSO Credentials -magento_sso_oauth_credentials: false \ No newline at end of file +magento_sso_oauth_credentials: false + +## Set additional project specific configuration can be added +#magento_additional_configuration: | +# here is your multiline content for env.php, +# and more +# and more +# and more \ No newline at end of file diff --git a/templates/etc/env.php.j2 b/templates/etc/env.php.j2 index 75a8b4f..60ea7ff 100644 --- a/templates/etc/env.php.j2 +++ b/templates/etc/env.php.j2 @@ -132,30 +132,15 @@ return array ( 'cron_run' => false ), {% endif %} - {% if magento_queue_amqp is defined%} - {% if magento_sso_oauth_credentials %} - 'websso_oauth' => - array ( - 'domain' => '{{ magento_sso_oauth_credentials.domain }}', - 'client_id' => '{{ magento_sso_oauth_credentials.client_id }}', - 'client_secret' => '{{ magento_sso_oauth_credentials.client_secret }}', - ), - {% endif %} - {% if magento_sap_oauth_credentials %} - 'sap_api' => - array ( - 'connection' => - array ( - 'username' => '{{ magento_sap_oauth_credentials.connection.username }}', - 'password' => '{{ magento_sap_oauth_credentials.connection.password }}' - ), - 'uri' => - array ( - 'availability' => '{{ magento_sap_oauth_credentials.uri.availability }}', - 'order_history' => '{{ magento_sap_oauth_credentials.uri.order_history }}', - 'order_simulate' => '{{ magento_sap_oauth_credentials.uri.order_simulate }}', - ), - ) - {% endif %} + {% if magento_sso_oauth_credentials is defined %} + 'websso_oauth' => + array ( + 'domain' => '{{ magento_sso_oauth_credentials.domain }}', + 'client_id' => '{{ magento_sso_oauth_credentials.client_id }}', + 'client_secret' => '{{ magento_sso_oauth_credentials.client_secret }}', + ), + {% endif %} + {% if magento_additional_configuration is defined %} + {{ magento_additional_configuration }} {% endif %} ); From 5acbbac11867ab1b3da59359056f94901782e5be Mon Sep 17 00:00:00 2001 From: aario-sitewards <39617851+aario-sitewards@users.noreply.github.com> Date: Mon, 16 Dec 2019 13:24:55 +0100 Subject: [PATCH 3/7] AdHoc(sso) Added conditional step Configure webSSO --- tasks/installation.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/installation.yml b/tasks/installation.yml index 0fd5592..893f61f 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -217,6 +217,12 @@ command: "/usr/bin/php {{ magento_app_root }}/bin/magento indexer:reindex" when: magento_db_status.stdout_lines|length == 0 or magento_force_reindex_on_deploy == True +- name: "Configure webSSO" + become: "yes" + become_user: "{{ magento_user }}" + command: "/usr/bin/php {{ magento_app_root }}/bin/magento websso:configure" + when: magento_sso_oauth_credentials == True + - name: "Disable maintenance mode" file: path: "{{ magento_release_folder }}/{{ magento_release_version }}/var/.maintenance.flag" From f525468726235ab3b9ff9a56367a9aa63f01c2d3 Mon Sep 17 00:00:00 2001 From: Omar Tuffaha Date: Mon, 16 Dec 2019 14:32:26 +0100 Subject: [PATCH 4/7] adhoc add newline at end of file because it should end with a line at the end --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index f6735c2..953a7b7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -311,4 +311,4 @@ magento_sso_oauth_credentials: false # here is your multiline content for env.php, # and more # and more -# and more \ No newline at end of file +# and more From 4cca62a20f11bc0f84165d304709f9ca886c0cfd Mon Sep 17 00:00:00 2001 From: "Zeno F. Pensky" Date: Mon, 16 Dec 2019 15:07:47 +0100 Subject: [PATCH 5/7] AdHoc (sso) simplify and bring in constinece Adding also example code into defaults/main.yml for how to configgure sso. --- defaults/main.yml | 5 ++++- tasks/installation.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 953a7b7..6a6da0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -304,7 +304,10 @@ magento_clones_cleanup_min_age: "1d" magento_force_reindex_on_deploy: False ## Set SSO Credentials -magento_sso_oauth_credentials: false +#magento_sso_oauth_credentials: +# domain: '***' +# client_id: '****' +# client_secret: '***' ## Set additional project specific configuration can be added #magento_additional_configuration: | diff --git a/tasks/installation.yml b/tasks/installation.yml index 893f61f..1471668 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -221,7 +221,7 @@ become: "yes" become_user: "{{ magento_user }}" command: "/usr/bin/php {{ magento_app_root }}/bin/magento websso:configure" - when: magento_sso_oauth_credentials == True + when: magento_sso_oauth_credentials is defind - name: "Disable maintenance mode" file: From b0ad38139c43421f8c339b310894393f45db2543 Mon Sep 17 00:00:00 2001 From: aario-sitewards <39617851+aario-sitewards@users.noreply.github.com> Date: Mon, 16 Dec 2019 16:14:05 +0100 Subject: [PATCH 6/7] ZAR-1034 ZAR-1153 feat (sso): Fixed typo syntax error --- tasks/installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/installation.yml b/tasks/installation.yml index 1471668..00f9301 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -221,7 +221,7 @@ become: "yes" become_user: "{{ magento_user }}" command: "/usr/bin/php {{ magento_app_root }}/bin/magento websso:configure" - when: magento_sso_oauth_credentials is defind + when: magento_sso_oauth_credentials is defined - name: "Disable maintenance mode" file: From 4c6741025e40404a439fcf61823951c28a271e44 Mon Sep 17 00:00:00 2001 From: aario-sitewards <39617851+aario-sitewards@users.noreply.github.com> Date: Tue, 17 Dec 2019 14:44:44 +0100 Subject: [PATCH 7/7] ZAR-1034 Moved WebSSO configuration step before flush cache --- tasks/installation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/installation.yml b/tasks/installation.yml index 00f9301..75b500c 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -206,6 +206,12 @@ EOF with_items: "{{ magento_core_config_data }}" +- name: "Configure webSSO" + become: "yes" + become_user: "{{ magento_user }}" + command: "/usr/bin/php {{ magento_app_root }}/bin/magento websso:configure" + when: magento_sso_oauth_credentials is defined + - name: "Flush the Magento caches" become: "yes" become_user: "{{ magento_user }}" @@ -217,12 +223,6 @@ command: "/usr/bin/php {{ magento_app_root }}/bin/magento indexer:reindex" when: magento_db_status.stdout_lines|length == 0 or magento_force_reindex_on_deploy == True -- name: "Configure webSSO" - become: "yes" - become_user: "{{ magento_user }}" - command: "/usr/bin/php {{ magento_app_root }}/bin/magento websso:configure" - when: magento_sso_oauth_credentials is defined - - name: "Disable maintenance mode" file: path: "{{ magento_release_folder }}/{{ magento_release_version }}/var/.maintenance.flag"