From 5c226a9c6f4c4f50f0bb4ddf85b4e599d10e58bc Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Sat, 23 Apr 2022 21:32:54 +0200 Subject: [PATCH 1/5] fix tomcat.sh script permissions --- roles/tomcat/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tomcat/tasks/main.yml b/roles/tomcat/tasks/main.yml index ba33f445c..d989d4c52 100644 --- a/roles/tomcat/tasks/main.yml +++ b/roles/tomcat/tasks/main.yml @@ -25,7 +25,7 @@ dest: "{{ binaries_folder }}/tomcat.sh" group: "{{ group_name }}" owner: "{{ username }}" - mode: "0755" + mode: "0750" tags: - molecule-idempotence-notest # Files is dealt with outside this role From 9a342253b0a8af6c27ad2d4b14ce379b8aa38b46 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Sat, 23 Apr 2022 21:33:41 +0200 Subject: [PATCH 2/5] better deal with idempotency accross roles --- roles/java/tasks/main.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/roles/java/tasks/main.yml b/roles/java/tasks/main.yml index 87f1edab0..add263992 100644 --- a/roles/java/tasks/main.yml +++ b/roles/java/tasks/main.yml @@ -22,11 +22,15 @@ - --xform=s|[^/]*|{{ java_home | basename }}| - name: Add setenv bash file - template: - src: setenv.sh - dest: "{{ config_folder }}/setenv.sh" + blockinfile: + path: "{{ config_folder }}/setenv.sh" + marker: "# {mark} JAVA ENV VARS" + create: yes + block: | + #!/bin/sh + # + export JAVA_HOME="{{ java_home }}" + export PATH="${JAVA_HOME}/bin:${PATH}" owner: "{{ username }}" group: "{{ group_name }}" mode: "0755" - tags: - - molecule-idempotence-notest From 5e22010697e8d8b55031ec1641dd6a3bce0dc905 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Sat, 23 Apr 2022 22:27:04 +0200 Subject: [PATCH 3/5] add all services restart playbook and tests --- molecule/default/side_effects.yml | 3 + playbooks/platform-restart.yml | 186 ++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 molecule/default/side_effects.yml create mode 100644 playbooks/platform-restart.yml diff --git a/molecule/default/side_effects.yml b/molecule/default/side_effects.yml new file mode 100644 index 000000000..9bc648ca7 --- /dev/null +++ b/molecule/default/side_effects.yml @@ -0,0 +1,3 @@ +--- +- name: Restart all services in order + import_playbook: ../../playbooks/platform-restart.yml diff --git a/playbooks/platform-restart.yml b/playbooks/platform-restart.yml new file mode 100644 index 000000000..1a022eb83 --- /dev/null +++ b/playbooks/platform-restart.yml @@ -0,0 +1,186 @@ +--- +- hosts: adw + gather_facts: no + become: true + tasks: + - name: Stop Alfresco Digital Workspace + service: + name: nginx + state: stopped + tags: + - alfresco + - stop + +- hosts: nginx + gather_facts: no + become: true + tasks: + - name: Stop Reverse Proxy + service: + name: nginx + state: stopped + tags: + - infrastructure + - stop + +- hosts: syncservice + gather_facts: no + become: true + tasks: + - name: Stop Alfresco Sync services + service: + name: alfresco-sync + state: stopped + tags: + - alfresco + - stop + +- hosts: search + gather_facts: no + become: true + tasks: + - name: Stop Alfresco Search services + service: + name: alfresco-search + state: stopped + tags: + - alfresco + - stop + +- hosts: repository + gather_facts: no + become: true + tasks: + - name: Stop Alfresco Content services + service: + name: alfresco-content{% if groups.repository | length > 1 %}-monitored-startup{% endif %} + state: stopped + tags: + - alfresco + - stop + +- hosts: transformers + gather_facts: no + become: true + tasks: + - name: Stop Alfresco Transformation services + service: + name: "{{ item }}" + state: stopped + loop: + - alfresco-shared-fs + - alfresco-transform-router + - alfresco-tengine-aio + tags: + - alfresco + - stop + +- hosts: database + become: true + tasks: + - name: Stop PostgreSQL + service: + name: postgresql{% if ansible_os_family != 'Debian' %}{{ dependencies_version.postgres_major_version }}{% endif %} + state: stopped + tags: + - infrastructure + - stop + +- hosts: activemq + gather_facts: no + become: true + tasks: + - name: Stop ActiveMQ + service: + name: activemq + state: stopped + tags: + - infrastructure + - stop + +- hosts: activemq + gather_facts: no + become: true + tasks: + - name: Start ActiveMQ + service: + name: activemq + state: started + tags: + - infrastructure + - start + +- hosts: database + become: true + tasks: + - name: Start PostgreSQL + service: + name: postgresql{% if ansible_os_family != 'Debian' %}{{ dependencies_version.postgres_major_version }}{% endif %} + state: started + tags: + - infrastructure + - start + +- hosts: transformers + gather_facts: no + become: true + tasks: + - name: Start Alfresco Transformation services + service: + name: "{{ item }}" + state: started + loop: + - alfresco-shared-fs + - alfresco-transform-router + - alfresco-tengine-aio + tags: + - alfresco + - start + +- hosts: repository + gather_facts: no + become: true + tasks: + - name: Start Alfresco Content services + service: + name: alfresco-content{% if groups.repository | length > 1 %}-monitored-startup{% endif %} + state: started + tags: + - alfresco + - start + +- hosts: search + gather_facts: no + become: true + tasks: + - name: Start Alfresco Search services + service: + name: alfresco-search + state: started + tags: + - alfresco + - start + +- hosts: syncservice + gather_facts: no + become: true + tasks: + - name: Start Alfresco Sync services + service: + name: alfresco-sync + state: started + tags: + - alfresco + - start + +- hosts: nginx + gather_facts: no + become: true + tasks: + - name: Start Reverse Proxy + service: + name: nginx + state: started + tags: + - infrastructure + - start From cd2c40fb1ae678f6816359b514807921d3ecc62e Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 25 Apr 2022 09:53:03 +0200 Subject: [PATCH 4/5] call side_Effect as we're not calling full test sequence --- tests/molecule_it/script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/molecule_it/script.sh b/tests/molecule_it/script.sh index 15adad284..fd6799821 100755 --- a/tests/molecule_it/script.sh +++ b/tests/molecule_it/script.sh @@ -13,6 +13,8 @@ if [ -n "$MOLECULE_IT_SCENARIO" ]; then # shellcheck disable=SC2086 molecule $EXTRA_CONFIG converge -s "$MOLECULE_IT_SCENARIO" || exit 1 # shellcheck disable=SC2086 + molecule $EXTRA_CONFIG side_effect -s "$MOLECULE_IT_SCENARIO" + # shellcheck disable=SC2086 molecule $EXTRA_CONFIG verify -s "$MOLECULE_IT_SCENARIO" else echo "$1: invalid command" From 46b165b483ed4abf7cc3419534d708e02c859be6 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 25 Apr 2022 20:38:30 +0200 Subject: [PATCH 5/5] molecule command differ from test step name --- tests/molecule_it/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/molecule_it/script.sh b/tests/molecule_it/script.sh index fd6799821..30465c569 100755 --- a/tests/molecule_it/script.sh +++ b/tests/molecule_it/script.sh @@ -13,7 +13,7 @@ if [ -n "$MOLECULE_IT_SCENARIO" ]; then # shellcheck disable=SC2086 molecule $EXTRA_CONFIG converge -s "$MOLECULE_IT_SCENARIO" || exit 1 # shellcheck disable=SC2086 - molecule $EXTRA_CONFIG side_effect -s "$MOLECULE_IT_SCENARIO" + molecule $EXTRA_CONFIG side-effect -s "$MOLECULE_IT_SCENARIO" # shellcheck disable=SC2086 molecule $EXTRA_CONFIG verify -s "$MOLECULE_IT_SCENARIO" else