|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 |
2 | 2 | --- |
3 | 3 |
|
4 | | -# Reason for noqa: The command might change things but we do not yet attempt to find out |
5 | | -- name: SAP SWPM Post Install - ensure password expiry disabled {{ sap_swpm_sid | lower + 'adm' }} |
6 | | - ansible.builtin.shell: | |
7 | | - chage -m 0 -M 99999 -I -1 -E -1 {{ sap_swpm_sid | lower }}adm |
8 | | - chage -m 0 -M 99999 -I -1 -E -1 sapadm |
9 | | - args: |
10 | | - executable: /bin/bash |
11 | | - become: true |
12 | | - register: __sap_swpm_post_install_register_sidadm_noexpire |
13 | | - changed_when: __sap_swpm_post_install_register_sidadm_noexpire is succeeded |
14 | | - when: sap_swpm_set_sidadm_noexpire | default(true) |
| 4 | +# Set user expiration update |
| 5 | +- name: SAP SWPM Post Install - Get list of available OS users |
| 6 | + ansible.builtin.getent: |
| 7 | + database: passwd |
15 | 8 |
|
16 | | -# Firewall steps are part of pre_tasks to ensure that ports are open before installation. |
17 | | - |
18 | | -######################################################################################################################## |
| 9 | +# New task file includes detailed steps to set each parameter, instead of all at same time. |
| 10 | +- name: SAP SWPM Post Install - Execute user expiration task file |
| 11 | + ansible.builtin.include_tasks: |
| 12 | + file: post_install/set_password_expiration.yml |
| 13 | + loop: |
| 14 | + - "{{ sap_swpm_sid | lower }}adm" |
| 15 | + - "sapadm" |
| 16 | + loop_control: |
| 17 | + loop_var: user_item |
| 18 | + when: |
| 19 | + - user_item in ansible_facts['getent_passwd'] |
| 20 | + - sap_swpm_set_sidadm_noexpire | d(true) |
19 | 21 |
|
20 | | -- name: SAP SWPM Deployment - Finished |
21 | | - ansible.builtin.debug: |
22 | | - msg: | |
23 | | - " SAP SWPM deployment successfully completed " |
24 | | - " " |
25 | | - " SAP Product - {{ sap_swpm_product_catalog_id }} " |
26 | | - " SID - {{ sap_swpm_sid | d('') }} " |
27 | | - " Primary Instance - {{ sap_swpm_pas_instance_nr | d('') }} " |
28 | | - " Host - {{ ansible_facts['hostname'] }} " |
29 | | - " FQDN - {{ ansible_facts['fqdn'] }} " |
30 | | - " IP - {{ ansible_facts['default_ipv4'].address | d(ansible_facts['all_ipv4_addresses'][0]) }} " |
31 | | -# " Master Password - {{ sap_swpm_master_password }} " |
32 | | -# " DDIC 000 Password - {{ sap_swpm_ddic_000_password }} " |
| 22 | +# Firewall steps are part of pre_tasks to ensure that ports are open before installation. |
33 | 23 |
|
34 | 24 | # SAP HANA Client will not be installed for any installation with SAP AnyDB |
35 | 25 | # and will only be installed alongside SAP NWAS PAS or AAS (not NWAS ASCS) |
|
55 | 45 | register: __sap_swpm_post_install_register_hdbuserstore_connection |
56 | 46 | changed_when: __sap_swpm_post_install_register_hdbuserstore_connection is succeeded |
57 | 47 |
|
| 48 | + |
| 49 | +# Restart saphostctrl process to ensure it loads information about newly installed SAP system. |
| 50 | +- name: SAP SWPM Post Install - Restart saphostctrl process |
| 51 | + ansible.builtin.command: |
| 52 | + cmd: /usr/sap/hostctrl/exe/saphostexec -restart |
| 53 | + become: true |
| 54 | + when: |
| 55 | + - sap_swpm_install_saphostagent | d(true) |
| 56 | + # Restart only for freshly installed SAP system. |
| 57 | + - not __sap_swpm_sap_detected | d(false) or sap_swpm_force | d(false) |
| 58 | + # Restart can be always considered changed. |
| 59 | + changed_when: true |
| 60 | + |
| 61 | + |
| 62 | +######################################################################################################################## |
| 63 | + |
| 64 | +- name: SAP SWPM Deployment - Display SAP System details after completion |
| 65 | + ansible.builtin.debug: |
| 66 | + msg: | |
| 67 | + SAP System or Instance is deployed. |
| 68 | + {% if __sap_swpm_sap_detected | d(false) and not sap_swpm_force | d(false) %} |
| 69 | +
|
| 70 | + NOTE: SAP Instance(s) were detected before installation. |
| 71 | + SWPM installation steps were skipped to avoid potential issues with existing installation. |
| 72 | +
|
| 73 | + If you intend to proceed with the installation despite this warning, |
| 74 | + set 'sap_swpm_force' variable to 'true' and execute this Ansible Role again. |
| 75 | + {% endif %} |
| 76 | + {% if __sap_swpm_sap_detected | d(false) and sap_swpm_force | d(false) %} |
| 77 | +
|
| 78 | + NOTE: SAP Instance(s) were detected before installation. |
| 79 | + SWPM installation steps were executed regardless, |
| 80 | + because 'sap_swpm_force' variable is set to 'true' (default is 'false'). |
| 81 | + {% endif %} |
| 82 | +
|
| 83 | + SAP Product - {{ sap_swpm_product_catalog_id }} |
| 84 | + SID - {{ sap_swpm_sid | d('') }} |
| 85 | + Primary Instance - {{ sap_swpm_pas_instance_nr | d('') }} |
| 86 | + Host - {{ ansible_facts['hostname'] }} |
| 87 | + FQDN - {{ ansible_facts['fqdn'] }} |
| 88 | + IP - {{ ansible_facts['default_ipv4'].address | d(ansible_facts['all_ipv4_addresses'][0]) }} |
| 89 | +
|
| 90 | +
|
58 | 91 | # Now that SWPM finished we may need to deal with SUM before continuing when sap_swpm_sum_start: 'true' |
59 | 92 | # and if we are doing OneHost or CI/PAS installation |
60 | 93 | # If observer mode is enabled, SWPM will wait for SUM to finish before continuing so we can't do anything here |
|
65 | 98 | - not __sap_swpm_fact_observer_mode |
66 | 99 | - "'NW_ABAP_CI:' in sap_swpm_product_catalog_id | string or |
67 | 100 | 'NW_ABAP_OneHost:' in sap_swpm_product_catalog_id | string" |
| 101 | + - not __sap_swpm_sap_detected | d(false) or sap_swpm_force | d(false) |
0 commit comments