Skip to content

Commit a9ceb1a

Browse files
authored
Merge pull request sap-linuxlab#1191 from berndfinger/hana_install_etc_hosts_media_detect_INJECT_FACTS_AS_VARS-3
sap_maintain_etc_hosts, sap_hana_install, sap_install_media_detect: Ansible 2.24 compatibility
2 parents a24719d + 9e21878 commit a9ceb1a

13 files changed

Lines changed: 36 additions & 36 deletions

File tree

roles/sap_hana_install/tasks/pre_tasks/check_filesystems.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
- name: SAP HANA - Install - Pre-Tasks - Set fact with mount details of {{ sap_hana_install_shared_path }}
1515
ansible.builtin.set_fact:
1616
__sap_hana_install_fact_mount_hana_shared:
17-
"{{ ansible_mounts | selectattr('mount', 'equalto', sap_hana_install_shared_path) | list | first }}"
18-
when: ansible_mounts | selectattr('mount', 'equalto', sap_hana_install_shared_path) | list | length > 0
17+
"{{ ansible_facts['mounts'] | selectattr('mount', 'equalto', sap_hana_install_shared_path) | list | first }}"
18+
when: ansible_facts['mounts'] | selectattr('mount', 'equalto', sap_hana_install_shared_path) | list | length > 0
1919

2020
- name: SAP HANA - Install - Pre-Tasks - Assert that filesystem is shared - {{ sap_hana_install_shared_path }}
2121
ansible.builtin.assert:
@@ -56,8 +56,8 @@
5656
- name: SAP HANA - Install - Pre-Tasks - Set fact with mount details of {{ __sap_hana_install_lss_inst_path }}
5757
ansible.builtin.set_fact:
5858
__sap_hana_install_fact_mount_lss_shared:
59-
"{{ ansible_mounts | selectattr('mount', 'equalto', __sap_hana_install_lss_inst_path) | list | first }}"
60-
when: ansible_mounts | selectattr('mount', 'equalto', __sap_hana_install_lss_inst_path) | list | length > 0
59+
"{{ ansible_facts['mounts'] | selectattr('mount', 'equalto', __sap_hana_install_lss_inst_path) | list | first }}"
60+
when: ansible_facts['mounts'] | selectattr('mount', 'equalto', __sap_hana_install_lss_inst_path) | list | length > 0
6161

6262
- name: SAP HANA - Install - Pre-Tasks - Assert that filesystem is shared - {{ __sap_hana_install_lss_inst_path }}
6363
ansible.builtin.assert:

roles/sap_hana_install/templates/sap-nw-input.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#
55

66
# SAP HANA Instance Parameters
7-
sap_swpm_db_ip: '{{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }}'
8-
sap_swpm_db_fqdn: '{{ ansible_fqdn }}'
9-
sap_swpm_db_host: '{{ ansible_hostname }}'
10-
sap_swpm_db_sid: '{{ sap_hana_install_sid }}'
11-
sap_swpm_db_instance_nr: '{{ sap_hana_install_number }}'
7+
sap_swpm_db_ip: "{{ ansible_facts['default_ipv4'].address|default(ansible_facts['all_ipv4_addresses'][0]) }}"
8+
sap_swpm_db_fqdn: "{{ ansible_facts['fqdn'] }}"
9+
sap_swpm_db_host: "{{ ansible_facts['hostname'] }}"
10+
sap_swpm_db_sid: "{{ sap_hana_install_sid }}"
11+
sap_swpm_db_instance_nr: "{{ sap_hana_install_number }}"
1212

1313
# SAP HANA Passwords
1414
sap_swpm_db_system_password: '{{ sap_hana_install_db_system_password|d(sap_hana_install_master_password) }}'

roles/sap_hana_install/vars/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ __sap_hana_install_sid_prohibited: ['ADD', 'ADM', 'ALL', 'AMD', 'AND', 'ANY', 'A
88
__sap_hana_install_fact_tmp_dirname: ''
99

1010
# This dictionary defines keyword rules to identify SAP binaries compatible with modern Linux distributions supported by SAP HANA.
11-
# Each key is a valid `ansible_architecture` value.
11+
# Each key is a valid "ansible_facts['architecture']" value.
1212
# The value is a list of rule sets, where each rule set is a list of keywords.
1313
# A file is considered a match if all keywords from any single rule set are found in the `file` command's output.
1414
__sap_hana_install_architecture_matrix:
@@ -40,7 +40,7 @@ __sap_hana_install_architecture_matrix:
4040
- ['aarch64']
4141

4242
# Sets the default host which will run all non-addhosts tasks.
43-
__sap_hana_install_fact_main_host: "{{ ansible_hostname }}"
43+
__sap_hana_install_fact_main_host: "{{ ansible_facts['hostname'] }}"
4444

4545
# Sets default value of Scale-Out detection.
4646
# Detection for scaleout is based on addhosts string.

roles/sap_install_media_detect/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Based on this setting, the commands for listing and extracting RAR files are bei
167167
### sap_install_media_detect_epel_gpg_key_url
168168

169169
- _Type:_ `str`
170-
- _Default:_ `https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}`
170+
- _Default:_ `https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_facts['distribution_major_version'] }}`
171171

172172
URL for the EPEL GPG key
173173

roles/sap_install_media_detect/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sap_install_media_detect_rar_package: 'EPEL'
1111
#sap_install_media_detect_rar_package: 'linux-rar'
1212

1313
# URL for the EPEL GPG key
14-
sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
14+
sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_facts['distribution_major_version'] }}"
1515

1616
# The EPEL GPG key can be removed with the rpm_key module and the URL for the key, or by using the rpm -e command.
1717
# For using the rpm -e command, set this variable to 'false'.

roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Note: This file is only included from tasks/main.yml if the epel-release package had not been initially detected.
55

66
- name: SAP Install Media Detect - Cleanup - Get all GPG keys
7-
ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | awk '/gpg/&&/Fedora/{gsub ("\\(epel", "EPEL "); gsub (" \\(", " "); if ($0 ~ /EPEL {{ ansible_distribution_major_version }}/)print}'
7+
ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | awk '/gpg/&&/Fedora/{gsub ("\\(epel", "EPEL "); gsub (" \\(", " "); if ($0 ~ /EPEL {{ ansible_facts['distribution_major_version'] }}/)print}'
88
register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys
99
failed_when: false
1010
changed_when: false
@@ -30,7 +30,7 @@
3030
- __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1
3131

3232
- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal, rpm -e
33-
ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})'
33+
ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_facts['distribution_major_version'] }})'
3434
register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal
3535
changed_when: false
3636
failed_when: false

roles/sap_install_media_detect/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
when:
9999
- sap_install_media_detect_rar_handling
100100
- sap_install_media_detect_rar_package == 'EPEL'
101-
- ansible_os_family == 'RedHat'
101+
- ansible_facts['os_family'] == 'RedHat'
102102
- __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release'
103103

104104
- name: SAP Install Media Detect - Cleanup - Remove sapfile utility

roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- name: SAP Install Media Detect - Prepare - Install the unar package from EPEL
55
when:
66
- sap_install_media_detect_rar_package == 'EPEL'
7-
- ansible_os_family == 'RedHat'
7+
- ansible_facts['os_family'] == 'RedHat'
88
block:
99

1010
# Reason for noqa: Too much effort for now to examine the output of the yum module for the presence of a package
@@ -33,12 +33,12 @@
3333

3434
# - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL
3535
# ansible.builtin.set_fact:
36-
# sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
36+
# sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts['distribution_major_version'] }}.noarch.rpm"
3737

3838
- name: SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo
3939
ansible.builtin.package:
4040
# name: "{{ sap_install_media_detect_epel_url }}"
41-
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
41+
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts['distribution_major_version'] }}.noarch.rpm"
4242
state: present
4343
retries: 10
4444

@@ -60,7 +60,7 @@
6060

6161
- name: SAP Install Media Detect - Prepare - Install the unar package (SLES)
6262
when:
63-
- ansible_os_family == 'Suse'
63+
- ansible_facts['os_family'] == 'Suse'
6464
block:
6565

6666
# Requires SLES Basesystem_Module_* to obtain package

roles/sap_maintain_etc_hosts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Following dictionary keys can be defined:
123123
- _Type:_ `string`
124124

125125
- **node_domain**<br>
126-
Domain name of the managed node. Defaults to `sap_domain` if set or `ansible_domain`.<br>
126+
Domain name of the managed node. Defaults to `sap_domain` if set or `ansible_facts['domain']`.<br>
127127
**Required** for adding new entries to `/etc/hosts`.</br>
128128
_Optional_ for removing entries, when `node_name` is used.
129129

roles/sap_maintain_etc_hosts/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# When deleting a node use only when node_ip is not defined
1717
# - node_domain
1818
# Domainname of the node
19-
# Defaults to sap_domain, if set, otherwise ansible_domain is the default
19+
# Defaults to sap_domain, if set, otherwise ansible_facts['domain'] is the default
2020
# When deleting a node use only when node_name is defined
2121
# - aliases
2222
# List of aliases for the node

0 commit comments

Comments
 (0)