From 7d425c38cd733a923c421fd5870a6ef73673d87e Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 18 Apr 2024 10:38:13 +0200 Subject: [PATCH 1/4] sap_swpm: Remove the pids module Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/swpm.yml | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 08ee1001d..77d0e96a1 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -23,20 +23,19 @@ ### Async method # Required for Ansible Module pids -- name: Install Python devel, Python pip and gcc to system Python - ansible.builtin.package: - name: - - python3-devel - - python3-pip - - gcc - state: present +#- name: Install Python devel, Python pip and gcc to system Python +# ansible.builtin.package: +# name: +# - python3-devel +# - python3-pip +# - gcc +# state: present # Required for Ansible Module pids -- name: Install Python dependency psutil to system Python - ansible.builtin.pip: - name: - - psutil -# executable: pip3.6 +#- name: Install Python dependency psutil to system Python +# ansible.builtin.pip: +# name: +# - psutil - name: Set fact for the sapinst command line ansible.builtin.set_fact: @@ -71,15 +70,12 @@ poll: 0 # Seconds between polls, use 0 to run Ansible Tasks concurrently # Monitor sapinst process (i.e. ps aux | grep sapinst) and wait for exit -- name: SAP SWPM - Wait for sapinst process to exit, poll every 60 seconds - community.general.pids: - name: sapinst -# shell: ps -ef | awk '/sapinst/&&!/awk/&&!/ansible/{print}' +- name: SAP SWPM - Wait for sapinst process to exit, poll every 10 seconds + ansible.builtin.shell: ps -ef | awk '/sapinst/&&!/awk/&&!/ansible/{print}' register: pids_sapinst - until: "pids_sapinst.pids | length == 0" -# until: "pids_sapinst.stdout | length == 0" + until: "pids_sapinst.stdout | length == 0" retries: 1000 - delay: 60 + delay: 10 - name: SAP SWPM - Verify if sapinst process finished successfully ansible.builtin.async_status: From 59a21d5deaddb974d7c63a39f1ef3fb245678af9 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 18 Apr 2024 16:47:21 +0200 Subject: [PATCH 2/4] sap_swpm: Minor tweaks Relates to #716 and #719. Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/swpm.yml | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 77d0e96a1..4762fa3f0 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -22,24 +22,9 @@ ### Async method -# Required for Ansible Module pids -#- name: Install Python devel, Python pip and gcc to system Python -# ansible.builtin.package: -# name: -# - python3-devel -# - python3-pip -# - gcc -# state: present - -# Required for Ansible Module pids -#- name: Install Python dependency psutil to system Python -# ansible.builtin.pip: -# name: -# - psutil - - name: Set fact for the sapinst command line ansible.builtin.set_fact: - __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | default('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} + __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | d('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} {{ sap_swpm_swpm_command_product_id }} {{ sap_swpm_swpm_command_extra_args }}" tags: sap_swpm_sapinst_commandline @@ -69,13 +54,13 @@ async: 32400 # Seconds for maximum runtime, set to 9 hours poll: 0 # Seconds between polls, use 0 to run Ansible Tasks concurrently -# Monitor sapinst process (i.e. ps aux | grep sapinst) and wait for exit -- name: SAP SWPM - Wait for sapinst process to exit, poll every 10 seconds - ansible.builtin.shell: ps -ef | awk '/sapinst/&&!/awk/&&!/ansible/{print}' +# Monitor sapinst process and wait for exit +- name: SAP SWPM - Wait for sapinst process to exit, poll every 60 seconds + ansible.builtin.shell: ps -ef | awk '/sapinst/&&!/ awk /{print}' register: pids_sapinst until: "pids_sapinst.stdout | length == 0" retries: 1000 - delay: 10 + delay: 60 - name: SAP SWPM - Verify if sapinst process finished successfully ansible.builtin.async_status: From 74af7623553182d4c8d4d1efe1bbac39145ba0ae Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 18 Apr 2024 16:58:33 +0200 Subject: [PATCH 3/4] sap_swpm: Solve ansible-lint errors Relates to #719. Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/swpm.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 4762fa3f0..cb3323c1c 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -56,11 +56,12 @@ # Monitor sapinst process and wait for exit - name: SAP SWPM - Wait for sapinst process to exit, poll every 60 seconds - ansible.builtin.shell: ps -ef | awk '/sapinst/&&!/ awk /{print}' + ansible.builtin.shell: set -o pipefail && ps -ef | awk '/sapinst/&&!/ awk /{print}' register: pids_sapinst until: "pids_sapinst.stdout | length == 0" retries: 1000 delay: 60 + changed_when: false - name: SAP SWPM - Verify if sapinst process finished successfully ansible.builtin.async_status: From ef02f9f0c189e09eb8eaa316c1d78a8c8e533257 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 18 Apr 2024 22:43:56 +0200 Subject: [PATCH 4/4] sap_swpm: Improve the sapinst command pattern Relates to #719. Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/swpm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index cb3323c1c..4e527608f 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -56,7 +56,7 @@ # Monitor sapinst process and wait for exit - name: SAP SWPM - Wait for sapinst process to exit, poll every 60 seconds - ansible.builtin.shell: set -o pipefail && ps -ef | awk '/sapinst/&&!/ awk /{print}' + ansible.builtin.shell: set -o pipefail && ps -ef | awk '/\.\/sapinst /&&!/umask/&&!/ awk /{print}' register: pids_sapinst until: "pids_sapinst.stdout | length == 0" retries: 1000