From 772585e3fa32fd8223188e9deb551298f82dcfb8 Mon Sep 17 00:00:00 2001 From: Michele Pagot Date: Tue, 8 Oct 2024 12:02:16 +0200 Subject: [PATCH 1/2] Change script to run yamllint Change the script to catch more files. Apparently '-exec' and '-print0' from 'find' filters out some files. --- .github/workflows/ansible.yml | 2 ++ tools/ansible_yaml_lint | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml index e12fb158..c855ea41 100644 --- a/.github/workflows/ansible.yml +++ b/.github/workflows/ansible.yml @@ -9,6 +9,8 @@ on: - ansible/** - requirements.txt - .github/workflows/ansible.yml + - Makefile + - tools/** jobs: build: diff --git a/tools/ansible_yaml_lint b/tools/ansible_yaml_lint index 098b9509..dcf9714f 100755 --- a/tools/ansible_yaml_lint +++ b/tools/ansible_yaml_lint @@ -9,7 +9,6 @@ echo "Run YAMLLINT_CMD:${YAMLLINT_CMD}" yamllint --version || exit 1 find ansible/ \ - -type f \ - -iname "*.yml" -or -iname "*.yaml" \ - ! -name "hana_media.yaml" ! -name "hana_vars.yaml" \ - -exec ${YAMLLINT_CMD} {} + + -type f -iname "*.yml" -or -iname "*.yaml" \ + ! -name "hana_media.yaml" ! -name "hana_vars.yaml" |\ + xargs -I{} ${YAMLLINT_CMD} {} From 7c532767cb3b4803b20daa242cef15d2eac4d3c0 Mon Sep 17 00:00:00 2001 From: Michele Pagot Date: Tue, 8 Oct 2024 13:17:35 +0200 Subject: [PATCH 2/2] Fix all the newly detected yamllint warnings Fix all warnings from yamllint: most of them are about indentation and yes/no --> true/false. Fix few Ansible lint warnings about FQDN names. --- .../roles/qe_sap_storage/defaults/main.yml | 10 +- ansible/roles/qe_sap_storage/meta/main.yml | 6 +- .../roles/qe_sap_storage/tasks/az_main.yml | 20 ++-- .../tasks/az_tasks/prepare_storage.yml | 32 ++--- .../tasks/az_tasks/remove_storage.yml | 12 +- .../tasks/generic_tasks/prepare_storage.yml | 18 +-- .../tasks/generic_tasks/remove_storage.yml | 6 +- .../sap_ha_install_hana_hsr/defaults/main.yml | 2 +- .../tasks/update_etchosts.yml | 2 +- .../roles/sap_hana_install/defaults/main.yml | 112 +++++++++--------- ansible/roles/sap_hana_install/meta/main.yml | 4 +- .../sap_hana_install/tasks/hana_addhosts.yml | 4 +- .../sap_hana_install/tasks/hana_exists.yml | 24 ++-- .../sap_hana_install/tasks/post_install.yml | 34 +++--- .../tasks/post_install/firewall.yml | 10 +- .../tasks/post_install/hdbuserstore.yml | 2 +- .../tasks/post_install/license.yml | 4 +- .../tasks/post_install/log_mode.yml | 6 +- .../post_install/recreate_tenant_database.yml | 2 +- .../tasks/post_install/update_firewall.yml | 4 +- .../sap_hana_install/tasks/pre_install.yml | 46 +++---- .../tasks/pre_install/hdblcm_configfile.yml | 6 +- .../tasks/pre_install/hdblcm_prepare.yml | 2 +- .../tasks/pre_install/prepare_sapcar.yml | 36 +++--- .../tasks/pre_install/prepare_sarfiles.yml | 2 +- .../tasks/pre_install/verify_checksum.yml | 12 +- .../tests/sapcar/prepare-sapcar-tests.yml | 14 +-- .../tests/sapcar/sapcar-vars.yml | 4 +- 28 files changed, 214 insertions(+), 222 deletions(-) diff --git a/ansible/roles/qe_sap_storage/defaults/main.yml b/ansible/roles/qe_sap_storage/defaults/main.yml index a31120e6..0f290e70 100644 --- a/ansible/roles/qe_sap_storage/defaults/main.yml +++ b/ansible/roles/qe_sap_storage/defaults/main.yml @@ -11,22 +11,16 @@ sap_storage_sap_type: 'sap_onehost' sap_storage_action: 'prepare' # prepare | remove - # Azure variables - sap_storage_az_imds_json: sap_storage_az_imds_url: 'http://169.254.169.254/metadata/instance/compute?api-version=2020-09-01' sap_storage_az_vmsize_url: 'http://169.254.169.254/metadata/instance/compute/vmSize?api-version=2017-08-01&format=text' - sap_storage_az_vmsize: - sap_storage_az_lun: '/dev/disk/azure/scsi1/lun' # AWS variables - -sap_storage_aws_imds_url: -sap_storage_aws_vmsize_url: - +sap_storage_aws_imds_url: +sap_storage_aws_vmsize_url: sap_storage_aws_vmsize: # IBM Cloud variables diff --git a/ansible/roles/qe_sap_storage/meta/main.yml b/ansible/roles/qe_sap_storage/meta/main.yml index 452b2c05..d355599e 100644 --- a/ansible/roles/qe_sap_storage/meta/main.yml +++ b/ansible/roles/qe_sap_storage/meta/main.yml @@ -7,8 +7,8 @@ galaxy_info: min_ansible_version: 2.9 platforms: - name: EL - versions: [ 7, 8, 9 ] + versions: [7, 8, 9] - name: SLES - versions: [ 15SP3 ] - galaxy_tags: [ 'sap', 'rhel', 'redhat', 'sles', 'suse' ] + versions: [15SP3] + galaxy_tags: ['sap', 'rhel', 'redhat', 'sles', 'suse'] dependencies: [] diff --git a/ansible/roles/qe_sap_storage/tasks/az_main.yml b/ansible/roles/qe_sap_storage/tasks/az_main.yml index 6384ab07..c3f80758 100644 --- a/ansible/roles/qe_sap_storage/tasks/az_main.yml +++ b/ansible/roles/qe_sap_storage/tasks/az_main.yml @@ -7,32 +7,32 @@ # Create json format of IMDS # Todo: Ansibilize this - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Create json format of IMDS - shell: | + ansible.builtin.shell: | curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_imds_url }}" | python3 -mjson.tool register: az_imds_reg args: executable: /bin/bash # If this fails, that means this VM is not Azure? -- set_fact: - sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}" +- ansible.builtin.set_fact: + sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}" # Pull VMSize # Todo: Ansibilize this - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Pull VMSize - shell: | + ansible.builtin.shell: | curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_vmsize_url }}" register: az_vmsize_reg args: executable: /bin/bash -- debug: - msg: - - "{{ az_vmsize_reg.stdout }}" +- ansible.builtin.debug: + msg: + - "{{ az_vmsize_reg.stdout }}" -- set_fact: - sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}" +- ansible.builtin.set_fact: + sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}" # Include vars depending on VM Size - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Load Variables for {{ sap_storage_az_vmsize }} - include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml" + ansible.builtin.include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml" diff --git a/ansible/roles/qe_sap_storage/tasks/az_tasks/prepare_storage.yml b/ansible/roles/qe_sap_storage/tasks/az_tasks/prepare_storage.yml index 524ffbe3..483effbb 100644 --- a/ansible/roles/qe_sap_storage/tasks/az_tasks/prepare_storage.yml +++ b/ansible/roles/qe_sap_storage/tasks/az_tasks/prepare_storage.yml @@ -3,10 +3,10 @@ # Striped volume - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Striped block: - + # Get LUNs from metadata - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata - shell: | + ansible.builtin.shell: | for i in {1..{{ item.value.numluns }}} do {{ item.value.vg }}${i}lun="{{ sap_storage_az_lun }} \ @@ -20,26 +20,26 @@ args: executable: /bin/bash register: pvs_reg - - - set_fact: + + - ansible.builtin.set_fact: pvs_list: "{{ pvs_reg.stdout.split() }}" # Create Volume Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group Striped - lvg: + community.general.lvg: vg: "{{ item.value.vg }}" pvs: "{{ pvs_list | join(',') }}" - force: yes + force: true # Create Logical Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - Striped - lvol: + community.general.lvol: vg: "{{ item.value.vg }}" lv: "{{ item.value.lv }}" size: 100%VG opts: "-i{{ item.value.numluns }} -I{{ item.value.stripesize }}" - when: + when: - "item.value.numluns != '1'" # Single volume @@ -48,7 +48,7 @@ # Get LUNs from metadata - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata - shell: | + ansible.builtin.shell: | {{ item.value.vg }}lun="{{ sap_storage_az_lun }} \ `awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \ /writeAcceleratorEnabled/ \ @@ -60,35 +60,35 @@ executable: /bin/bash register: pvs_reg - - set_fact: + - ansible.builtin.set_fact: pvs_one: "{{ pvs_reg.stdout }}" # Create Volume Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group One - lvg: + community.general.lvg: vg: "{{ item.value.vg }}" pvs: "{{ pvs_one }}" - force: yes + force: true # Create Logical Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - One - lvol: + community.general.lvol: vg: "{{ item.value.vg }}" lv: "{{ item.value.lv }}" size: 100%VG - when: + when: - "item.value.numluns == '1'" # Create Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Filesystem - filesystem: + community.general.filesystem: fstype: xfs dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}" # Mount Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Mount - mount: + ansible.posix.mount: path: "{{ item.value.directory }}" fstype: xfs src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}" diff --git a/ansible/roles/qe_sap_storage/tasks/az_tasks/remove_storage.yml b/ansible/roles/qe_sap_storage/tasks/az_tasks/remove_storage.yml index 4c65c9a5..5b31a0d8 100644 --- a/ansible/roles/qe_sap_storage/tasks/az_tasks/remove_storage.yml +++ b/ansible/roles/qe_sap_storage/tasks/az_tasks/remove_storage.yml @@ -2,26 +2,26 @@ # Unmount Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem - mount: + ansible.posix.mount: path: "{{ item.value.directory }}" state: absent # Remove Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem - shell: | + ansible.builtin.shell: | /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} # Remove Logical Volume - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume - lvol: + community.general.lvol: lv: "{{ item.value.lv }}" vg: "{{ item.value.vg }}" state: absent - force: yes + force: true # Remove Volume Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group - lvg: + community.general.lvg: vg: "{{ item.value.vg }}" state: absent - force: yes + force: true diff --git a/ansible/roles/qe_sap_storage/tasks/generic_tasks/prepare_storage.yml b/ansible/roles/qe_sap_storage/tasks/generic_tasks/prepare_storage.yml index 3c53959f..895dd8ff 100644 --- a/ansible/roles/qe_sap_storage/tasks/generic_tasks/prepare_storage.yml +++ b/ansible/roles/qe_sap_storage/tasks/generic_tasks/prepare_storage.yml @@ -1,43 +1,43 @@ --- -- debug: +- ansible.builtin.debug: msg: "{{ item }} " # Create Volume Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Volume Group One - lvg: + community.general.lvg: vg: "{{ item.value.vg }}" pvs: "{{ item.value.pv }}" - force: yes + force: true # Create Logical Group - One - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - One - lvol: + community.general.lvol: vg: "{{ item.value.vg }}" lv: "{{ item.value.lv }}" size: 100%VG - when: + when: - "item.value.numluns == '1'" # Create Logical Group - Striped - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - Striped - lvol: + community.general.lvol: vg: "{{ item.value.vg }}" lv: "{{ item.value.lv }}" size: 100%VG opts: "-i {{ item.value.numluns }} -I {{ item.value.stripesize }}" - when: + when: - "item.value.numluns != '1'" # Create Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Filesystem - filesystem: + community.general.filesystem: fstype: xfs dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}" # Mount Filesystem - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Mount - mount: + ansible.posix.mount: path: "{{ item.value.directory }}" fstype: xfs src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}" diff --git a/ansible/roles/qe_sap_storage/tasks/generic_tasks/remove_storage.yml b/ansible/roles/qe_sap_storage/tasks/generic_tasks/remove_storage.yml index a493213f..74a314ec 100644 --- a/ansible/roles/qe_sap_storage/tasks/generic_tasks/remove_storage.yml +++ b/ansible/roles/qe_sap_storage/tasks/generic_tasks/remove_storage.yml @@ -18,7 +18,7 @@ - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem shell: | /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} - ignore_errors: yes + ignore_errors: true # Remove Logical Volume - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume @@ -26,11 +26,11 @@ lv: "{{ item.value.lv }}" vg: "{{ item.value.vg }}" state: absent - force: yes + force: true # Remove Volume Group - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group lvg: vg: "{{ item.value.vg }}" state: absent - force: yes + force: true diff --git a/ansible/roles/sap_ha_install_hana_hsr/defaults/main.yml b/ansible/roles/sap_ha_install_hana_hsr/defaults/main.yml index bc3f8ca4..5aed4c99 100644 --- a/ansible/roles/sap_ha_install_hana_hsr/defaults/main.yml +++ b/ansible/roles/sap_ha_install_hana_hsr/defaults/main.yml @@ -9,4 +9,4 @@ sap_ha_install_hana_hsr_fqdn: "{{ sap_domain }}" sap_ha_install_hana_hsr_rep_mode: sync sap_ha_install_hana_hsr_oper_mode: logreplay -sap_ha_install_hana_hsr_update_etchosts: yes +sap_ha_install_hana_hsr_update_etchosts: true diff --git a/ansible/roles/sap_ha_install_hana_hsr/tasks/update_etchosts.yml b/ansible/roles/sap_ha_install_hana_hsr/tasks/update_etchosts.yml index 606b06e6..20de358e 100644 --- a/ansible/roles/sap_ha_install_hana_hsr/tasks/update_etchosts.yml +++ b/ansible/roles/sap_ha_install_hana_hsr/tasks/update_etchosts.yml @@ -8,7 +8,7 @@ path: /etc/hosts create: true state: present - backup: yes + backup: true line: "{{ item.node_ip }}\t{{ item.node_name }}.{{ sap_ha_install_hana_hsr_fqdn }}\t{{ item.node_name }}" regexp: (?i)^\s*{{ item.node_ip }}\s+{{ item.node_name }} loop: "{{ sap_ha_install_hana_hsr_cluster_nodes }}" diff --git a/ansible/roles/sap_hana_install/defaults/main.yml b/ansible/roles/sap_hana_install/defaults/main.yml index 9ee3d91f..5a40db0f 100644 --- a/ansible/roles/sap_hana_install/defaults/main.yml +++ b/ansible/roles/sap_hana_install/defaults/main.yml @@ -14,36 +14,36 @@ sap_hana_install_software_extract_directory: "{{ sap_hana_install_software_direc # Set this variabe to `yes` if you want to copy the SAR files from `sap_hana_install_software_directory` # to `sap_hana_install_software_extract_directory/sarfiles` before extracting. # This might be useful if the SAR files are on a slow fileshare. -sap_hana_install_copy_sarfiles: no +sap_hana_install_copy_sarfiles: false # Set the following variable to `yes` if you want to keep the copied SAR files. By default, the SAR files will be # removed after extraction. -sap_hana_install_keep_copied_sarfiles: no +sap_hana_install_keep_copied_sarfiles: false # File name of SAPCAR*EXE in the software directory. If the variable is not set and there is more than one SAPCAR executable # in the software directory, the latest SAPCAR executable for the CPU architecture will be selected automatically. -#sap_hana_install_sapcar_filename: SAPCAR_1115-70006178.EXE +# sap_hana_install_sapcar_filename: SAPCAR_1115-70006178.EXE # List of file names of SAR files to extract. Can be set in case there are more SAR files in the software directory # than needed or desired for the HANA installation. -#sap_hana_install_sarfiles: +# sap_hana_install_sarfiles: # - SAPHOSTAGENT54_54-80004822.SAR # - IMDB_SERVER20_060_0-80002031.SAR # Set the following variable to `yes` to let the role abort if checksum verification fails for any SAPCAR or SAR file # called or used by the role. -sap_hana_install_verify_checksums: no +sap_hana_install_verify_checksums: false # Checksum algorithm for checksum verification. Default is sha256, for which a checksum is available in the SAP software # download pages. sap_hana_install_checksum_algorithm: sha256 # In case a global checksum file is present, use the following variable to specify the full path to this file: -#sap_hana_install_global_checksum_file: "{{ sap_hana_install_software_directory }}/SHA256" +# sap_hana_install_global_checksum_file: "{{ sap_hana_install_software_directory }}/SHA256" # Set the following variable to `yes` to let hdbclm verify SAR file signatures. This corresponds to the hdblcm command line # argument `--verify_signature`. -sap_hana_install_verify_signature: no +sap_hana_install_verify_signature: false # hdblcm configfile related variables: # Directory where to store the hdblcm configfile template and the Jinja2 template: @@ -57,31 +57,31 @@ sap_hana_install_local_configfile_directory: '/tmp' # If you would like to perform an installation check after the installation, set the following variable to 'yes'. # Note: This only works if there is no static configfile available in sap_hana_install_configfile_directory. -sap_hana_install_check_installation: no +sap_hana_install_check_installation: false # Only if sap_hana_install_check_installation (above) is set to 'yes', you can select which command to use by setting the -# following variable to `yes` or `no`. -# yes: use the command 'hdbcheck', with parameters `--remote_execution=ssh` and `--scope=system` -# no: use the command `hdblcm --action=check_installation` -sap_hana_install_use_hdbcheck: yes +# following variable to `true` or `false`. +# true: use the command 'hdbcheck', with parameters `--remote_execution=ssh` and `--scope=system` +# false: use the command `hdblcm --action=check_installation` +sap_hana_install_use_hdbcheck: true -# If the following variable is set to `no`, the role will attempt to install SAP HANA even if there is already a sidadm user. -# Default is `yes`. -sap_hana_install_check_sidadm_user: yes +# If the following variable is set to `false`, the role will attempt to install SAP HANA even if there is already a sidadm user. +# Default is `true`. +sap_hana_install_check_sidadm_user: true # If the following variable is undefined or set to `yes`, the role will perform a fresh SAP HANA installation. -# If set to `no`, additional hosts as specified by variable sap_hana_install_addhosts will be added to +# If set to `false`, additional hosts as specified by variable sap_hana_install_addhosts will be added to # an existing HANA system. -sap_hana_install_new_system: yes +sap_hana_install_new_system: true # The first tenant database is using a port range not within the range of the ports of additional tenant databases. # In case this is not desired, you can set the following parameter to `yes` to recreate the initial tenant database. -sap_hana_install_recreate_tenant_database: no +sap_hana_install_recreate_tenant_database: false # The following parameter controls if the log_mode should be set to overwrite following the installation of the database. # log_mode overwrite is useful in non-prod testing as log backups are not created and disk use is kept low # However, log_mode overwrite disabled to ability to do point-in-time restores and is not supported in production -sap_hana_set_log_mode_overwrite: no +sap_hana_set_log_mode_overwrite: false ################ # Parameters for hdblcm: @@ -91,8 +91,8 @@ sap_hana_set_log_mode_overwrite: no sap_hana_install_components: 'all' # Pass some extra arguments to hdblcm, see some examples below. -#sap_hana_install_hdblcm_extraargs: '--verify_signature' -#sap_hana_install_hdblcm_extraargs: '--ignore=check_diskspace,check_min_mem' +# sap_hana_install_hdblcm_extraargs: '--verify_signature' +# sap_hana_install_hdblcm_extraargs: '--ignore=check_diskspace,check_min_mem' # Instance details sap_hana_install_sid: @@ -105,60 +105,60 @@ sap_hana_install_restrict_max_mem: 'n' sap_hana_install_max_mem: # hdblcm will use default ids if blank -sap_hana_install_userid: +sap_hana_install_userid: sap_hana_install_groupid: # Passwords # Setting master password to 'y' will use that master password for all passwords - recommended sap_hana_install_use_master_password: 'y' # Set one or more of the following password variables in your playbook or inventory. -#sap_hana_install_master_password: -#sap_hana_install_sidadm_password: -#sap_hana_install_db_system_password: -#sap_hana_install_lss_user_password: -#sap_hana_install_lss_backup_password: -#sap_hana_install_ase_user_password: -#sap_hana_install_root_password: -#sap_hana_install_sapadm_password: -#sap_hana_install_xs_org_password: +# sap_hana_install_master_password: +# sap_hana_install_sidadm_password: +# sap_hana_install_db_system_password: +# sap_hana_install_lss_user_password: +# sap_hana_install_lss_backup_password: +# sap_hana_install_ase_user_password: +# sap_hana_install_root_password: +# sap_hana_install_sapadm_password: +# sap_hana_install_xs_org_password: # Optional steps -sap_hana_install_update_firewall: no +sap_hana_install_update_firewall: false # List of firewall ports for SAP HANA. Note: The structure of the variable is compatible # with the variable `firewall` of Linux System Role `firewall`. sap_hana_install_firewall: - - { port: - ['1128-1129/tcp', - '43{{ sap_hana_install_number }}/tcp', - '5050/tcp', - '9090-9093/tcp', - '3{{ sap_hana_install_number }}00-3{{ sap_hana_install_number }}90/tcp', - '30105/tcp', - '30107/tcp', - '30140/tcp', - '4{{ sap_hana_install_number }}01-4{{ sap_hana_install_number }}02/tcp', - '4{{ sap_hana_install_number }}06/tcp', - '4{{ sap_hana_install_number }}12/tcp', - '4{{ sap_hana_install_number }}14/tcp', - '4{{ sap_hana_install_number }}40/tcp', - '5{{ sap_hana_install_number }}00/tcp', - '5{{ sap_hana_install_number }}13-5{{ sap_hana_install_number }}14/tcp', - '51000/tcp', - '64997/tcp'], - state: 'enabled' } + - {port: + ['1128-1129/tcp', + '43{{ sap_hana_install_number }}/tcp', + '5050/tcp', + '9090-9093/tcp', + '3{{ sap_hana_install_number }}00-3{{ sap_hana_install_number }}90/tcp', + '30105/tcp', + '30107/tcp', + '30140/tcp', + '4{{ sap_hana_install_number }}01-4{{ sap_hana_install_number }}02/tcp', + '4{{ sap_hana_install_number }}06/tcp', + '4{{ sap_hana_install_number }}12/tcp', + '4{{ sap_hana_install_number }}14/tcp', + '4{{ sap_hana_install_number }}40/tcp', + '5{{ sap_hana_install_number }}00/tcp', + '5{{ sap_hana_install_number }}13-5{{ sap_hana_install_number }}14/tcp', + '51000/tcp', + '64997/tcp'], + state: 'enabled'} # The following variable is no longer used. Setting /etc/hosts entries is done in role sap_general_preconfigure. -#sap_hana_install_update_etchosts: yes +# sap_hana_install_update_etchosts: true # Post install parameters sap_hana_install_hdbuserstore_key: 'HDB_SYSTEMDB' sap_hana_install_nw_input_location: '/tmp' # License -sap_hana_install_apply_license: no -#sap_hana_install_license_path: -#sap_hana_install_license_file_name: +sap_hana_install_apply_license: false +# sap_hana_install_license_path: +# sap_hana_install_license_file_name: # Misc @@ -178,7 +178,7 @@ sap_hana_install_create_initial_tenant: 'y' # hosts to an existing HANA system. # Corresponding hdblcm parameter: addhosts # Example: -#sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02' +# sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02' # The hostname is set by 'hdblcm --dump_configfile_template' during the preinstall phase but can also # be set to a different value in your playbook or hostvars: diff --git a/ansible/roles/sap_hana_install/meta/main.yml b/ansible/roles/sap_hana_install/meta/main.yml index 9c72ba4e..e1c9c06a 100644 --- a/ansible/roles/sap_hana_install/meta/main.yml +++ b/ansible/roles/sap_hana_install/meta/main.yml @@ -8,6 +8,6 @@ galaxy_info: min_ansible_version: 2.9 platforms: - name: EL - versions: [ 7, 8, 9 ] - galaxy_tags: [ 'sap', 'hana', 'rhel', 'redhat', 'sles', 'suse' ] + versions: [7, 8, 9] + galaxy_tags: ['sap', 'hana', 'rhel', 'redhat', 'sles', 'suse'] dependencies: [] diff --git a/ansible/roles/sap_hana_install/tasks/hana_addhosts.yml b/ansible/roles/sap_hana_install/tasks/hana_addhosts.yml index 15a576f4..d3afa5ad 100644 --- a/ansible/roles/sap_hana_install/tasks/hana_addhosts.yml +++ b/ansible/roles/sap_hana_install/tasks/hana_addhosts.yml @@ -31,7 +31,7 @@ args: chdir: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/hdblcm" register: __sap_hana_install_register_hdblcm_list_systems - changed_when: no + changed_when: false - name: SAP HANA Add Hosts - Show the output of hdblcm --list_systems ansible.builtin.debug: @@ -89,7 +89,7 @@ args: chdir: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/hdblcm" register: __sap_hana_install_register_addhosts_result - changed_when: no + changed_when: false when: not ansible_check_mode - name: SAP HANA Add Hosts - Show the HANA version and hosts diff --git a/ansible/roles/sap_hana_install/tasks/hana_exists.yml b/ansible/roles/sap_hana_install/tasks/hana_exists.yml index 957803c7..41067f61 100644 --- a/ansible/roles/sap_hana_install/tasks/hana_exists.yml +++ b/ansible/roles/sap_hana_install/tasks/hana_exists.yml @@ -5,10 +5,10 @@ - name: Check for sidadm user ansible.builtin.command: getent passwd {{ sap_hana_install_sid | lower }}adm - check_mode: no + check_mode: false register: __sap_hana_install_register_getent_passwd_sidadm - changed_when: no - failed_when: no + changed_when: false + failed_when: false - name: SAP HANA Checks - Assert that there is no sidadm user ansible.builtin.assert: @@ -26,10 +26,10 @@ - name: SAP HANA Checks - Get info about the ID of the sapsys group ansible.builtin.command: getent group sapsys - check_mode: no + check_mode: false register: __sap_hana_install_register_getent_group_sapsys - changed_when: no - failed_when: no + changed_when: false + failed_when: false - name: SAP HANA Checks - In case there is a group sapsys, assert that its group ID is identical to sap_hana_install_groupid ansible.builtin.assert: @@ -37,8 +37,8 @@ success_msg: "PASS: The group ID of 'sapsys' is identical to the value of variable sap_hana_install_groupid, which is '{{ sap_hana_install_groupid }}'" fail_msg: "FAIL: Group sapsys exists but with a different group ID than '{{ sap_hana_install_groupid }}', - which has been specified in variable sap_hana_install_groupid. - Because of this, SAP HANA with SID '{{ sap_hana_install_sid }}' will not be installed." + which has been specified in variable sap_hana_install_groupid. + Because of this, SAP HANA with SID '{{ sap_hana_install_sid }}' will not be installed." when: __sap_hana_install_register_getent_group_sapsys.rc == 0 when: @@ -49,9 +49,9 @@ - name: SAP HANA Checks - Get info about directory '/hana/shared/{{ sap_hana_install_sid }}' ansible.builtin.stat: path: "/hana/shared/{{ sap_hana_install_sid }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hana_shared_sid_assert - failed_when: no + failed_when: false - name: SAP HANA Checks - Assert that directory '/hana/shared/{{ sap_hana_install_sid }}' does not exist ansible.builtin.assert: @@ -63,9 +63,9 @@ - name: SAP HANA Checks - Get info about directory '/usr/sap/{{ sap_hana_install_sid }}' ansible.builtin.stat: path: "/usr/sap/{{ sap_hana_install_sid }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_usr_sap_sid_assert - failed_when: no + failed_when: false - name: SAP HANA Checks - Assert that directory '/usr/sap/{{ sap_hana_install_sid }}' does not exist ansible.builtin.assert: diff --git a/ansible/roles/sap_hana_install/tasks/post_install.yml b/ansible/roles/sap_hana_install/tasks/post_install.yml index 09098185..a705b3fb 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install.yml @@ -28,13 +28,12 @@ ansible.builtin.include_tasks: post_install/recreate_tenant_database.yml when: sap_hana_install_recreate_tenant_database|d(true) -# Optional Post Install Tasks - -# not needed because already done in sap_general_preconfigure -#- name: SAP HANA Post Install - Update /etc/hosts -# ansible.builtin.include_tasks: post_install/update_etchosts.yml -# when: -# - "sap_hana_install_update_etchosts | bool" + # Optional Post Install Tasks + # not needed because already done in sap_general_preconfigure + # - name: SAP HANA Post Install - Update /etc/hosts + # ansible.builtin.include_tasks: post_install/update_etchosts.yml + # when: + # - "sap_hana_install_update_etchosts | bool" - name: SAP HANA Post Install - Firewall ansible.builtin.include_tasks: post_install/firewall.yml @@ -53,7 +52,6 @@ when: sap_hana_install_new_system|d(true) -################ - name: Perform an hdblcm installation check block: @@ -66,7 +64,7 @@ !/^ /&&/^\n")} /^ /{split ($0, b, "[\*\*\*]"); gsub (">", ""); split ($0, a, "<"); printf ("%s\{\{ sap_hana_install_%s|d(sap_hana_install_master_password) \}\}%s\n", b[1], a[2], b[4])}' {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.cfg.xml > {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.xml.j2 register: __sap_hana_install_create_jinja2_template - changed_when: no + changed_when: false - name: SAP HANA hdblcm installation check - Display the location of the remote Jinja2 template ansible.builtin.debug: @@ -111,8 +109,8 @@ ansible.builtin.debug: var: __sap_hana_install_fact_installation_check_command -# Reason for noqa: The command to be executed contains input redirection - - name: SAP HANA hdblcm installation check - Perform the check # noqa command-instead-of-shell + # Reason for noqa: The command to be executed contains input redirection + - name: SAP HANA hdblcm installation check - Perform the check # noqa command-instead-of-shell ansible.builtin.shell: "{{ __sap_hana_install_fact_installation_check_command }}" args: chdir: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/global/hdb/install/bin" @@ -124,8 +122,8 @@ var: __sap_hana_install_register_installation_check.stdout_lines when: sap_hana_install_use_hdbcheck|d(true) -# Reason for noqa: The command to be executed contains input redirection - - name: SAP HANA hdblcm installation check - Perform the check # noqa command-instead-of-shell + # Reason for noqa: The command to be executed contains input redirection + - name: SAP HANA hdblcm installation check - Perform the check # noqa command-instead-of-shell ansible.builtin.shell: "{{ __sap_hana_install_fact_installation_check_command }}" args: chdir: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/hdblcm" @@ -152,7 +150,7 @@ args: chdir: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/hdblcm" register: __sap_hana_install_register_install_result - changed_when: no + changed_when: false when: not ansible_check_mode - name: Set fact - HANA version @@ -174,8 +172,8 @@ - ' Hosts - {{ __sap_hana_install_fact_hana_hosts }}' - ' SID - {{ sap_hana_install_sid }}' - ' NR - {{ sap_hana_install_number }}' -# - ' Master Password - {{ sap_hana_install_master_password }}' -# - ' IP - {{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }}' -# - ' Host - {{ ansible_hostname }}' -# - ' FQDN - {{ ansible_fqdn }}' + # - ' Master Password - {{ sap_hana_install_master_password }}' + # - ' IP - {{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }}' + # - ' Host - {{ ansible_hostname }}' + # - ' FQDN - {{ ansible_fqdn }}' when: not ansible_check_mode diff --git a/ansible/roles/sap_hana_install/tasks/post_install/firewall.yml b/ansible/roles/sap_hana_install/tasks/post_install/firewall.yml index a11661b6..bbe1a9e0 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/firewall.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/firewall.yml @@ -4,7 +4,7 @@ ansible.builtin.systemd: name: firewalld state: started - enabled: yes + enabled: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Construct the argument list for 'firewall-cmd --add-port' @@ -37,12 +37,12 @@ # of the no-changed-when rule, we just set changed_when to true here. - name: SAP HANA Post Install - Enable the required ports immediately ansible.builtin.command: "{{ __sap_hana_install_fact_firewall_cmd_command }}" - changed_when: yes + changed_when: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Get the current firewall configuration of the default zone ansible.builtin.command: firewall-cmd --list-all - changed_when: no + changed_when: false register: __sap_hana_install_register_current_firewall_ports tags: sap_hana_install_configure_firewall @@ -56,12 +56,12 @@ # of the no-changed-when rule, we just set changed_when to true here. - name: SAP HANA Post Install - Enable the required ports permanently ansible.builtin.command: "{{ __sap_hana_install_fact_firewall_cmd_command }} --permanent" - changed_when: yes + changed_when: true tags: sap_hana_install_configure_firewall - name: SAP HANA Post Install - Get the permanent firewall configuration of the default zone ansible.builtin.command: firewall-cmd --list-all - changed_when: no + changed_when: false register: __sap_hana_install_register_permanent_firewall_ports tags: sap_hana_install_configure_firewall diff --git a/ansible/roles/sap_hana_install/tasks/post_install/hdbuserstore.yml b/ansible/roles/sap_hana_install/tasks/post_install/hdbuserstore.yml index 3dc87098..9c2f2b85 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/hdbuserstore.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/hdbuserstore.yml @@ -11,7 +11,7 @@ become: true become_user: "{{ sap_hana_install_sid | lower }}adm" when: not ansible_check_mode - changed_when: no + changed_when: false register: __sap_hana_install_store_connection_information tags: sap_hana_install_store_connection_information diff --git a/ansible/roles/sap_hana_install/tasks/post_install/license.yml b/ansible/roles/sap_hana_install/tasks/post_install/license.yml index 08302ead..2ff8d950 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/license.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/license.yml @@ -12,6 +12,6 @@ become: true become_user: "{{ sap_hana_install_sid | lower }}adm" changed_when: "'0 rows affected' in addlicense.stdout" -# Variable not used: -# register: __sap_hana_install_register_post_install_apply_license + # Variable not used: + # register: __sap_hana_install_register_post_install_apply_license when: sap_hana_install_apply_license diff --git a/ansible/roles/sap_hana_install/tasks/post_install/log_mode.yml b/ansible/roles/sap_hana_install/tasks/post_install/log_mode.yml index 9cc1e332..0d9401b7 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/log_mode.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/log_mode.yml @@ -18,10 +18,10 @@ executable: /bin/bash become: true become_user: "{{ sap_hana_install_sid | lower }}adm" - when: + when: - not ansible_check_mode - sap_hana_set_log_mode_overwrite - changed_when: no + changed_when: false register: __sap_hana_install_hdbsql_logmode tags: sap_hana_install_set_log_mode @@ -29,4 +29,4 @@ ansible.builtin.debug: var: __sap_hana_install_hdbsql_logmode.stdout_lines tags: sap_hana_install_set_log_mode - when: sap_hana_set_log_mode_overwrite \ No newline at end of file + when: sap_hana_set_log_mode_overwrite diff --git a/ansible/roles/sap_hana_install/tasks/post_install/recreate_tenant_database.yml b/ansible/roles/sap_hana_install/tasks/post_install/recreate_tenant_database.yml index 12019d2b..69610474 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/recreate_tenant_database.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/recreate_tenant_database.yml @@ -20,7 +20,7 @@ become: true become_user: "{{ sap_hana_install_sid | lower }}adm" when: not ansible_check_mode - changed_when: no + changed_when: false register: __sap_hana_install_register_recreate_tenant_database - name: SAP HANA Post Install - Display the result of the hdbsql command diff --git a/ansible/roles/sap_hana_install/tasks/post_install/update_firewall.yml b/ansible/roles/sap_hana_install/tasks/post_install/update_firewall.yml index b2dfdb84..3e981689 100644 --- a/ansible/roles/sap_hana_install/tasks/post_install/update_firewall.yml +++ b/ansible/roles/sap_hana_install/tasks/post_install/update_firewall.yml @@ -5,6 +5,6 @@ ansible.posix.firewalld: zone: public port: "{{ passed_port }}/tcp" - permanent: yes - immediate: yes + permanent: true + immediate: true state: enabled diff --git a/ansible/roles/sap_hana_install/tasks/pre_install.yml b/ansible/roles/sap_hana_install/tasks/pre_install.yml index bbc89c74..0905ff55 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install.yml @@ -3,16 +3,16 @@ # Password Facts ################ -#- name: SAP HANA Pre Install - Set password facts when using master password -# ansible.builtin.set_fact: -# sap_hana_install_sapadm_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_sidadm_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_db_system_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_ase_user_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_xs_org_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_lss_user_password: "{{ sap_hana_install_master_password }}" -# sap_hana_install_lss_backup_password: "{{ sap_hana_install_master_password }}" -# when: sap_hana_install_use_master_password == 'y' +# - name: SAP HANA Pre Install - Set password facts when using master password +# ansible.builtin.set_fact: +# sap_hana_install_sapadm_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_sidadm_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_db_system_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_ase_user_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_xs_org_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_lss_user_password: "{{ sap_hana_install_master_password }}" +# sap_hana_install_lss_backup_password: "{{ sap_hana_install_master_password }}" +# when: sap_hana_install_use_master_password == 'y' ################ # Prepare software path @@ -24,9 +24,9 @@ - name: SAP HANA Pre Install - Check availability of software directory '{{ sap_hana_install_software_directory }}' ansible.builtin.stat: path: "{{ sap_hana_install_software_directory }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_software_directory - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that the software directory exists ansible.builtin.assert: @@ -51,31 +51,31 @@ - name: SAP HANA Pre Install - Get info about software extract directory '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.stat: path: "{{ sap_hana_install_software_extract_directory }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_software_extract_directory - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Change ownership of software extract directory '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.file: path: "{{ sap_hana_install_software_extract_directory }}" state: directory - recurse: yes + recurse: true mode: '0755' owner: root group: root when: __sap_hana_install_register_stat_software_extract_directory.stat.exists -# In case more than one installation is ongoing and extracting to the same shared directory, wait until the extraction has completed: + # In case more than one installation is ongoing and extracting to the same shared directory, wait until the extraction has completed: - name: SAP HANA Pre Install - Suspending if extraction status file '{{ sap_hana_install_software_extract_directory }}/__EXTRACTION_ONGOING__' exists ansible.builtin.wait_for: path: "{{ sap_hana_install_software_extract_directory }}/__EXTRACTION_ONGOING__" state: absent - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Find directory 'SAP_HANA_DATABASE' if '{{ sap_hana_install_software_extract_directory }}' exists ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database_initial @@ -91,9 +91,9 @@ - name: SAP HANA Pre Install - Get info about '{{ __sap_hana_install_fact_hdblcm_path }}/hdblcm' if found initially ansible.builtin.stat: path: "{{ __sap_hana_install_fact_hdblcm_path + '/hdblcm' }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hdblcm_initial - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that file 'hdblcm' is available if found initially ansible.builtin.assert: @@ -123,9 +123,9 @@ - name: SAP HANA Pre Install - Get info about '{{ __sap_hana_install_fact_hdblcm_path }}/hdblcm' ansible.builtin.stat: path: "{{ __sap_hana_install_fact_hdblcm_path + '/hdblcm' }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hdblcm - failed_when: no + failed_when: false - name: SAP HANA Pre Install - Assert that file 'hdblcm' is available ansible.builtin.assert: @@ -146,7 +146,7 @@ - name: SAP HANA Pre Install - Find directory 'SAP_HANA_DATABASE' in '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database_addhosts diff --git a/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_configfile.yml b/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_configfile.yml index 52148da9..230949ca 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_configfile.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_configfile.yml @@ -9,7 +9,7 @@ - name: SAP HANA Pre Install - Check if file '{{ sap_hana_install_configfile_directory }}/configfile.cfg' exists ansible.builtin.stat: path: "{{ sap_hana_install_configfile_directory }}/configfile.cfg" - check_mode: no + check_mode: false register: __sap_hana_install_register_stat_hdblcm_configfile - name: SAP HANA Pre Install - Notify about existing hdblcm configfile @@ -33,7 +33,7 @@ - name: SAP HANA Pre Install - Create the hdblcm configfile template '{{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.cfg' ansible.builtin.command: "{{ __sap_hana_install_fact_hdblcm_path }}/hdblcm --dump_configfile_template={{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.cfg" register: __sap_hana_install_register_hdblcm_output - changed_when: no + changed_when: false - name: SAP HANA Pre Install - Display the output of the hdblcm command ansible.builtin.debug: @@ -46,7 +46,7 @@ !/^[a-z]/{print} /^[a-z]/{printf ("%s=\{\{ sap_hana_install_%s|d(\047%s\047) \}\}\n", $1, $1, $2)}' {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.cfg > {{ sap_hana_install_configfile_directory }}/{{ sap_hana_install_configfile_template_prefix }}.j2 register: __sap_hana_install_create_jinja2_template - changed_when: no + changed_when: false - name: SAP HANA Pre Install - Display the location of the remote Jinja2 template ansible.builtin.debug: diff --git a/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml b/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml index 0a511908..d9018ccf 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml @@ -54,7 +54,7 @@ - name: SAP HANA hdblcm prepare - Find 'SAP_HANA_DATABASE' in '{{ sap_hana_install_software_extract_directory }}' ansible.builtin.find: paths: "{{ sap_hana_install_software_extract_directory }}" - recurse: yes + recurse: true file_type: directory patterns: 'SAP_HANA_DATABASE' register: __sap_hana_install_register_find_directory_sap_hana_database diff --git a/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sapcar.yml b/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sapcar.yml index acfd1e4a..e1101a45 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sapcar.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sapcar.yml @@ -14,9 +14,9 @@ msg: "FAIL: The SAPCAR EXE file '{{ sap_hana_install_software_directory }}/{{ sap_hana_install_sapcar_filename }}' does not exist!" when: not __sap_hana_install_register_sapcar_stat.stat.exists -# We cannot always use the SAPCAR executable in sap_hana_install_software_directory because there are -# some configurations in which executing files in this directory is not possible. So we always copy SAPCAR -# to directory 'sapcar' in sap_hana_install_software_extract_directory. We do not copy the SAPCAR checksum file. + # We cannot always use the SAPCAR executable in sap_hana_install_software_directory because there are + # some configurations in which executing files in this directory is not possible. So we always copy SAPCAR + # to directory 'sapcar' in sap_hana_install_software_extract_directory. We do not copy the SAPCAR checksum file. - name: SAP HANA hdblcm prepare - SAPCAR defined - Copy the SAPCAR executable to '{{ sap_hana_install_software_extract_directory }}/sapcar' ansible.builtin.copy: src: "{{ sap_hana_install_software_directory }}/{{ sap_hana_install_sapcar_filename }}" @@ -65,17 +65,17 @@ - name: SAP HANA hdblcm prepare - SAPCAR autodetection - Prepare the SAPCAR executable if 'sap_hana_install_sapcar_filename' is not defined block: -# We need the 'file' package for the 'file' command, which we need in the next task. -# RHEL: The 'file' package is contained in the Base software group, which should be installed already. - -# In the first step, we execute the file command for each of the SAPCAR EXE files. It displays the -# hardware architecture in the second output field, using a string which is different from the output -# of the 'uname -m' command. So we replace those strings by the "correct" ones. For ppc64 and ppc64le, -# the second output field is identical. So in this case, we also look at the third and forth output field, -# to handle cases where a ppc64 SAPCAR executable is present in the software directory. -# After selecting the SAPCAR EXE files for the current architecture, we copy them to a temporary -# directory sapcar_tmp in the software extract directory and then perform a checksum verification -# for these files if the corresponding variable is set. + # We need the 'file' package for the 'file' command, which we need in the next task. + # RHEL: The 'file' package is contained in the Base software group, which should be installed already. + + # In the first step, we execute the file command for each of the SAPCAR EXE files. It displays the + # hardware architecture in the second output field, using a string which is different from the output + # of the 'uname -m' command. So we replace those strings by the "correct" ones. For ppc64 and ppc64le, + # the second output field is identical. So in this case, we also look at the third and forth output field, + # to handle cases where a ppc64 SAPCAR executable is present in the software directory. + # After selecting the SAPCAR EXE files for the current architecture, we copy them to a temporary + # directory sapcar_tmp in the software extract directory and then perform a checksum verification + # for these files if the corresponding variable is set. - name: SAP HANA hdblcm prepare - SAPCAR autodetection - Create directory '{{ sap_hana_install_software_extract_directory }}/sapcar_tmp' ansible.builtin.file: path: "{{ sap_hana_install_software_extract_directory }}/sapcar_tmp" @@ -99,7 +99,7 @@ args: chdir: "{{ sap_hana_install_software_directory }}" register: __sap_hana_install_register_sapcar_matching_arch - changed_when: no + changed_when: false - name: SAP HANA hdblcm prepare - SAPCAR autodetection - Fail if no matching SAPCAR executable could be found ansible.builtin.fail: @@ -157,8 +157,8 @@ - __sap_hana_install_fact_sapcar_dict | length > 0 - sap_hana_install_verify_checksums -# For each file in temporary directory sapcar_tmp in the software extract directory, we run it with option -# --version and then identify the most recent one, which is then copied to directory sapcar. + # For each file in temporary directory sapcar_tmp in the software extract directory, we run it with option + # --version and then identify the most recent one, which is then copied to directory sapcar. - name: SAP HANA hdblcm prepare - SAPCAR autodetection - Identify the SAPCAR executable with the latest version ansible.builtin.shell: | set -o pipefail && @@ -171,7 +171,7 @@ args: chdir: "{{ sap_hana_install_software_extract_directory }}/sapcar_tmp" register: __sap_hana_install_register_latest_sapcar_file - changed_when: no + changed_when: false - name: SAP HANA hdblcm prepare - SAPCAR autodetection - Display SAPCAR executable file name, SAP kernel release, and patch number ansible.builtin.debug: diff --git a/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml b/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml index cd537f20..464051e7 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install/prepare_sarfiles.yml @@ -21,7 +21,7 @@ - name: SAP HANA hdblcm prepare - Find all SAR files in '{{ sap_hana_install_software_directory }}' ansible.builtin.find: paths: "{{ sap_hana_install_software_directory }}" - recurse: no + recurse: false file_type: file patterns: '*.SAR' register: __sap_hana_install_register_find_sarfiles diff --git a/ansible/roles/sap_hana_install/tasks/pre_install/verify_checksum.yml b/ansible/roles/sap_hana_install/tasks/pre_install/verify_checksum.yml index 93dc3989..4fd97c8b 100644 --- a/ansible/roles/sap_hana_install/tasks/pre_install/verify_checksum.yml +++ b/ansible/roles/sap_hana_install/tasks/pre_install/verify_checksum.yml @@ -13,14 +13,14 @@ - name: Continue if checksum file exists block: -# We are using awk to search for the file name in the checksum file. If there is no entry for the file, instead of -# displaying the checksum for the file, we display the string 'Missing entry' on stdout. -# Reason for noqa: A double brace might also occur in an awk command sequence. - - name: SAP HANA hdblcm prepare - Get expected checksum from file # noqa var-spacing + # We are using awk to search for the file name in the checksum file. If there is no entry for the file, instead of + # displaying the checksum for the file, we display the string 'Missing entry' on stdout. + # Reason for noqa: A double brace might also occur in an awk command sequence. + - name: SAP HANA hdblcm prepare - Get expected checksum from file # noqa var-spacing ansible.builtin.command: "awk 'BEGIN{a=0}/{{ __sap_hana_install_passed_file_dict.file }}/{a++; print $1}END{if (a==0){print \"Missing entry\"}}' {{ __sap_hana_install_passed_file_dict.checksum_file }}" - check_mode: no + check_mode: false register: __sap_hana_install_register_checksum_from_file - changed_when: no + changed_when: false - name: SAP HANA hdblcm prepare - Fail if an entry for file '{{ __sap_hana_install_passed_file_dict.file }}' is missing in '{{ __sap_hana_install_passed_file_dict.checksum_file }}' ansible.builtin.fail: diff --git a/ansible/roles/sap_hana_install/tests/sapcar/prepare-sapcar-tests.yml b/ansible/roles/sap_hana_install/tests/sapcar/prepare-sapcar-tests.yml index f3960658..599a8a8e 100644 --- a/ansible/roles/sap_hana_install/tests/sapcar/prepare-sapcar-tests.yml +++ b/ansible/roles/sap_hana_install/tests/sapcar/prepare-sapcar-tests.yml @@ -21,13 +21,13 @@ group: root mode: '0755' -# - name: Copy '/software/hana/{{ sap_hana_install_sapcar_filename }}' to '{{ sap_hana_install_software_directory }}' -# ansible.builtin.copy: -# src: "/software/hana/{{ sap_hana_install_sapcar_filename }}" -# dest: "{{ sap_hana_install_software_directory }}/" -# owner: root -# group: root -# mode: '0755' + # - name: Copy '/software/hana/{{ sap_hana_install_sapcar_filename }}' to '{{ sap_hana_install_software_directory }}' + # ansible.builtin.copy: + # src: "/software/hana/{{ sap_hana_install_sapcar_filename }}" + # dest: "{{ sap_hana_install_software_directory }}/" + # owner: root + # group: root + # mode: '0755' - name: Copy SAPCAR files from '/software/hana/' to '{{ sap_hana_install_software_directory }}' ansible.builtin.copy: diff --git a/ansible/roles/sap_hana_install/tests/sapcar/sapcar-vars.yml b/ansible/roles/sap_hana_install/tests/sapcar/sapcar-vars.yml index 0b904f62..784bd94f 100644 --- a/ansible/roles/sap_hana_install/tests/sapcar/sapcar-vars.yml +++ b/ansible/roles/sap_hana_install/tests/sapcar/sapcar-vars.yml @@ -5,6 +5,6 @@ sap_hana_install_number: 01 sap_hana_install_software_directory: '/software/sap_hana_install_test' sap_hana_install_checksum_algorithm: sha256 # sap_hana_install_sapcar_filename_ppc64: SAPCAR_1115-70006175.EXE # ppc64 -sap_hana_install_sapcar_filename_ppc64le: SAPCAR_1115-70006238.EXE # ppc64le +sap_hana_install_sapcar_filename_ppc64le: SAPCAR_1115-70006238.EXE # ppc64le # sap_hana_install_sapcar_filename: SAPCAR_1211-80000935.EXE # x86_64, rel 721, patch 1211 -sap_hana_install_sapcar_filename_x86_64: SAPCAR_1115-70006178.EXE # x86_64, rel 722, patch 1115 +sap_hana_install_sapcar_filename_x86_64: SAPCAR_1115-70006178.EXE # x86_64, rel 722, patch 1115