Skip to content

Commit

Permalink
Merge pull request #20 from sean-freeman/nolog_changes
Browse files Browse the repository at this point in the history
sap_vm_provision: nolog test fix final batch
  • Loading branch information
sean-freeman authored Apr 29, 2024
2 parents 88aca0b + 51ac613 commit 713e13b
Show file tree
Hide file tree
Showing 35 changed files with 328 additions and 230 deletions.
90 changes: 70 additions & 20 deletions roles/sap_vm_provision/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ sap_vm_provision_nfs_mount_point_type: "" # e.g. nfs, nfs4
sap_vm_provision_nfs_mount_point_opts: ""


####
# VM Provision - Generic configuration - Calculate for SAP HANA Scale-Out
# Only to be used for SAP HANA Scale-Out, and requires additional changes to
# the Ansible Play that creates the dynamic inventory group before execution
# of the Ansible Role (see documentation)
####

# sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator: 1
# sap_vm_provision_calculate_sap_hana_scaleout_active_worker: 2
# sap_vm_provision_calculate_sap_hana_scaleout_standby: 1 # Only 0 or 1


####
# VM Provision - dynamic inventory variables
# Cannot be given a value by end user, the Ansible Role populates the variable
Expand Down Expand Up @@ -241,32 +253,30 @@ sap_vm_provision_aws_ec2_vs_host_os_image_dictionary:
rhel-8-2: "*RHEL-8.2*_HVM*x86_64*"
rhel-8-4: "*RHEL-8.4*_HVM*x86_64*"
rhel-8-6: "*RHEL-8.6*_HVM*x86_64*"
rhel-7-7-sap-ha: "*RHEL-SAP-7.7*"
rhel-7-9-sap-ha: "*RHEL-SAP-7.9*"
rhel-8-8: "*RHEL-8.8*_HVM*x86_64*"
rhel-8-1-sap-ha: "*RHEL-SAP-8.1.0*"
rhel-8-2-sap-ha: "*RHEL-SAP-8.2.0*"
rhel-8-4-sap-ha: "*RHEL-SAP-8.4.0*"
rhel-8-6-sap-ha: "*RHEL-SAP-8.6.0*"
rhel-8-8-sap-ha: "*RHEL-SAP-8.8.0*"
rhel-9-0-sap-ha: "*RHEL-SAP-9.0.0*"
rhel-9-2-sap-ha: "*RHEL-SAP-9.2.0*"
sles-15-2: "*suse-sles-15-sp2-v202*-hvm-ssd-x86_64*"
sles-15-3: "*suse-sles-15-sp3-v202*-hvm-ssd-x86_64*"
sles-15-4: "*suse-sles-15-sp4-v202*-hvm-ssd-x86_64*"
sles-12-5-sap: "*suse-sles-sap-12-sp5-v202*-hvm-ssd-x86_64*"
sles-15-1-sap: "*suse-sles-sap-15-sp1-v202*-hvm-ssd-x86_64*"
sles-15-2-sap: "*suse-sles-sap-15-sp2-v202*-hvm-ssd-x86_64*"
sles-15-3-sap: "*suse-sles-sap-15-sp3-v202*-hvm-ssd-x86_64*"
sles-15-4-sap: "*suse-sles-sap-15-sp4-v202*-hvm-ssd-x86_64*"
sles-15-5: "*suse-sles-15-sp5-v202*-hvm-ssd-x86_64*"
sles-12-5-sap-ha: "*suse-sles-sap-12-sp5-v202*-hvm-ssd-x86_64*"
sles-15-1-sap-ha: "*suse-sles-sap-15-sp1-v202*-hvm-ssd-x86_64*"
sles-15-2-sap-ha: "*suse-sles-sap-15-sp2-v202*-hvm-ssd-x86_64*"
sles-15-3-sap-ha: "*suse-sles-sap-15-sp3-v202*-hvm-ssd-x86_64*"
sles-15-4-sap-ha: "*suse-sles-sap-15-sp4-v202*-hvm-ssd-x86_64*"
sles-15-5-sap-ha: "*suse-sles-sap-15-sp5-v202*-hvm-ssd-x86_64*"

# OS Images - Google Cloud
sap_vm_provision_gcp_ce_vm_host_os_image_dictionary:
rhel-8-latest:
project: "rhel-cloud"
family: "rhel-8"
rhel-7-7-sap-ha:
project: "rhel-sap-cloud"
family: "rhel-7-7-sap-ha"
rhel-7-9-sap-ha:
project: "rhel-sap-cloud"
family: "rhel-7-9-sap-ha"
rhel-8-1-sap-ha:
project: "rhel-sap-cloud"
family: "rhel-8-1-sap-ha"
Expand All @@ -279,6 +289,9 @@ sap_vm_provision_gcp_ce_vm_host_os_image_dictionary:
rhel-8-6-sap-ha:
project: "rhel-sap-cloud"
family: "rhel-8-6-sap-ha"
rhel-8-8-sap-ha:
project: "rhel-sap-cloud"
family: "rhel-8-8-sap-ha"
sles-15-latest:
project: "suse-cloud"
family: "sles-15"
Expand All @@ -297,12 +310,15 @@ sap_vm_provision_ibmcloud_vs_host_os_image_dictionary:
rhel-8-4: ".*redhat.*8-4.*minimal.*amd64.*"
rhel-8-6: ".*redhat.*8-6.*minimal.*amd64.*"
rhel-9-0: ".*redhat.*9-0.*minimal.*amd64.*"
rhel-7-9-sap-ha: ".*redhat.*7-9.*amd64.*hana.*"
rhel-9-2: ".*redhat.*9-2.*minimal.*amd64.*"
rhel-8-4-sap-ha: ".*redhat.*8-4.*amd64.*hana.*"
rhel-8-6-sap-ha: ".*redhat.*8-6.*amd64.*hana.*"
rhel-8-8-sap-ha: ".*redhat.*8-8.*amd64.*hana.*"
rhel-9-0-sap-ha: ".*redhat.*9-0.*amd64.*hana.*"
rhel-9-2-sap-ha: ".*redhat.*9-0.*amd64.*hana.*"
sles-15-3-sap-ha: ".*sles.*15-3.*amd64.*hana.*"
sles-15-4-sap: ".*sles.*15-4.*amd64.*hana.*"
sles-15-5-sap: ".*sles.*15-5.*amd64.*hana.*"
sles-15-4-sap-ha: ".*sles.*15-4.*amd64.*hana.*"
sles-15-5-sap-ha: ".*sles.*15-5.*amd64.*hana.*"

# OS Images - IBM Cloud, IBM Power VS 'Full Linux subscription' with support and activation keys
sap_vm_provision_ibmcloud_powervs_host_os_image_dictionary:
Expand All @@ -311,11 +327,12 @@ sap_vm_provision_ibmcloud_powervs_host_os_image_dictionary:
rhel-9-2: ".*RHEL.*9.*2"
sles-15-3: ".*SLES.*15.*3"
sles-15-4: ".*SLES.*15.*4"
rhel-8-4-sap-ha: ".*RHEL.*8.*4.*SAP$" # ensure string suffix using $
rhel-8-6-sap-ha: ".*RHEL.*8.*6.*SAP$" # ensure string suffix using $
sles-15-2-sap: ".*SLES.*15.*2.*SAP$" # ensure string suffix using $
sles-15-3-sap: ".*SLES.*15.*3.*SAP$" # ensure string suffix using $
sles-15-4-sap: ".*SLES.*15.*4.*SAP$" # ensure string suffix using $
rhel-8-8-sap-ha: ".*RHEL.*8.*8.*SAP$" # ensure string suffix using $
rhel-9-2-sap-ha: ".*RHEL.*9.*2.*SAP$" # ensure string suffix using $
sles-15-2-sap-ha: ".*SLES.*15.*2.*SAP$" # ensure string suffix using $
sles-15-3-sap-ha: ".*SLES.*15.*3.*SAP$" # ensure string suffix using $
sles-15-4-sap-ha: ".*SLES.*15.*4.*SAP$" # ensure string suffix using $

# OS Images - MS Azure
sap_vm_provision_msazure_vm_host_os_image_dictionary:
Expand All @@ -335,6 +352,22 @@ sap_vm_provision_msazure_vm_host_os_image_dictionary:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "84sapha-gen2"
rhel-8-6-sap-ha:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "86sapha-gen2"
rhel-8-8-sap-ha:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "88sapha-gen2"
rhel-9-0-sap-ha:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "90sapha-gen2"
rhel-9-2-sap-ha:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "92sapha-gen2"
rhel-8-1-sap-applications:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
Expand All @@ -347,6 +380,22 @@ sap_vm_provision_msazure_vm_host_os_image_dictionary:
publisher: "RedHat"
offer: "RHEL-SAP-HA"
sku: "84sapapps-gen2"
rhel-8-6-sap-applications:
publisher: "RedHat"
offer: "RHEL-SAP-applications"
sku: "86sapapps-gen2"
rhel-8-8-sap-applications:
publisher: "RedHat"
offer: "RHEL-SAP-applications"
sku: "88sapapps-gen2"
rhel-9-0-sap-applications:
publisher: "RedHat"
offer: "RHEL-SAP-applications"
sku: "90sapapps-gen2"
rhel-9-2-sap-applications:
publisher: "RedHat"
offer: "RHEL-SAP-applications"
sku: "92sapapps-gen2"
sles-15-sp3-sap:
publisher: "SUSE"
offer: "sles-sap-15-sp3"
Expand Down Expand Up @@ -421,6 +470,7 @@ sap_vm_provision_ibmcloud_powervs_host_specifications_dictionary:
example_host_specification_plan:
host1: # Hostname, must be 13 characters or less
virtual_machine_profile: ush1-4x256 # alt: use custom SAP instance profile sizes using cnp-2x16 (2 Power Cores [16 vCPU] x 16GB) and above
ibmcloud_powervs_hardware_machine_type: e980 # IBM Power hardware machine type (MT) used to host the Virtual Machine
disable_ip_anti_spoofing: true
#sap_system_type: project_dev # project_dev, project_tst, project_prd
sap_host_type: hana_primary # hana_primary, hana_secondary, anydb_primary, anydb_secondary, nwas_ascs, nwas_ers, nwas_pas, nwas_aas
Expand Down
31 changes: 14 additions & 17 deletions roles/sap_vm_provision/tasks/common/register_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
- name: Ansible Task block for RHEL Package Repositories setup
when:
- ansible_os_family == 'RedHat'
- sap_vm_provision_os_registration_ca_file_path is defined
- sap_vm_provision_os_registration_script_command is defined
- not sap_vm_provision_os_online_registration_user is defined
- not sap_vm_provision_os_online_registration_passcode is defined
- (sap_vm_provision_os_registration_script_command is defined) and (sap_vm_provision_os_registration_script_command | length > 0)
- (not sap_vm_provision_os_online_registration_user is defined) or (sap_vm_provision_os_online_registration_user | length == 0)
- (not sap_vm_provision_os_online_registration_passcode is defined) or (sap_vm_provision_os_online_registration_passcode | length == 0)
block:

- name: Red Hat Package Repositories - Clean any existing Red Hat Subscription Manager data
Expand All @@ -21,6 +20,7 @@
owner: root
group: root
mode: '0644'
when: (sap_vm_provision_os_registration_ca_file_path is defined) and (sap_vm_provision_os_registration_ca_file_path | length > 0)

- name: Red Hat Package Repositories - Update CA trust
ansible.builtin.command: update-ca-trust && update-ca-certificates
Expand All @@ -37,11 +37,9 @@
- name: Ansible Task block for SLES Package Repositories setup
when:
- ansible_os_family == 'Suse'
- sap_vm_provision_os_registration_ca_file_path is defined
- sap_vm_provision_os_registration_script_command is defined
- not sap_vm_provision_os_online_registration_user is defined
- not sap_vm_provision_os_online_registration_passcode is defined

- (sap_vm_provision_os_registration_script_command is defined) and (sap_vm_provision_os_registration_script_command | length > 0)
- (not sap_vm_provision_os_online_registration_user is defined) or (sap_vm_provision_os_online_registration_user | length == 0)
- (not sap_vm_provision_os_online_registration_passcode is defined) or (sap_vm_provision_os_online_registration_passcode | length == 0)
block:

- name: SUSE Package Repositories - Import CA file for SUSE RMT server
Expand All @@ -51,6 +49,7 @@
owner: root
group: root
mode: '0644'
when: (sap_vm_provision_os_registration_ca_file_path is defined) and (sap_vm_provision_os_registration_ca_file_path | length > 0)

- name: SUSE Package Repositories - Update CA trust
ansible.builtin.command: update-ca-trust && update-ca-certificates
Expand All @@ -66,10 +65,9 @@
- name: Ansible Task block for RHEL Online Package Repositories setup
when:
- ansible_os_family == 'RedHat'
- not sap_vm_provision_os_registration_ca_file_path is defined
- not sap_vm_provision_os_registration_script_command is defined
- sap_vm_provision_os_online_registration_user is defined
- sap_vm_provision_os_online_registration_passcode is defined
- (not sap_vm_provision_os_registration_script_command is defined) or (sap_vm_provision_os_registration_script_command | length == 0)
- (sap_vm_provision_os_online_registration_user is defined) or (sap_vm_provision_os_online_registration_user | length > 0)
- (sap_vm_provision_os_online_registration_passcode is defined) or (sap_vm_provision_os_online_registration_passcode | length > 0)
block:

- name: Red Hat Customer Portal (RHCP) Online Package Repositories - Execute
Expand All @@ -80,10 +78,9 @@
- name: Ansible Task block for SLES Online Package Repositories setup
when:
- ansible_os_family == 'Suse'
- not sap_vm_provision_os_registration_ca_file_path is defined
- not sap_vm_provision_os_registration_script_command is defined
- sap_vm_provision_os_online_registration_user is defined
- sap_vm_provision_os_online_registration_passcode is defined
- (not sap_vm_provision_os_registration_script_command is defined) or (sap_vm_provision_os_registration_script_command | length == 0)
- (sap_vm_provision_os_online_registration_user is defined) or (sap_vm_provision_os_online_registration_user | length > 0)
- (sap_vm_provision_os_online_registration_passcode is defined) or (sap_vm_provision_os_online_registration_passcode | length > 0)
block:

- name: SUSE Customer Center (SCC) Online Package Repositories - Execute
Expand Down
2 changes: 1 addition & 1 deletion roles/sap_vm_provision/tasks/common/register_proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- name: Ansible Task block for Web Forward Proxy setup
when:
- sap_vm_provision_proxy_web_forward_proxy_ip is defined
- (sap_vm_provision_proxy_web_forward_proxy_ip is defined) and (sap_vm_provision_proxy_web_forward_proxy_ip | length > 0)
block:

- name: Set var for non-interactive login shell on RHEL
Expand Down
4 changes: 2 additions & 2 deletions roles/sap_vm_provision/tasks/common/set_ansible_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
sap_ha_pacemaker_cluster_aws_region: "{{ sap_ha_pacemaker_cluster_aws_region }}"
sap_ha_pacemaker_cluster_aws_access_key_id: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}"
sap_ha_pacemaker_cluster_aws_secret_access_key: "{{ sap_ha_pacemaker_cluster_aws_secret_access_key }}"
sap_ha_pacemaker_cluster_aws_vip_update_rt: "{{ __sap_vm_provision_task_vpc_subnet_rt_info.route_tables[0].route_table_id }}"
sap_ha_pacemaker_cluster_aws_vip_update_rt: "{{ __sap_vm_provision_task_aws_vpc_subnet_rt_info.route_tables[0].route_table_id }}"
when:
- sap_ha_pacemaker_cluster_aws_region is defined
- sap_vm_provision_iac_platform == "aws_ec2_vs"
Expand All @@ -67,7 +67,7 @@

- name: Set facts for all hosts - use facts from localhost - HA/DR - IBM Cloud, IBM Power VS
ansible.builtin.set_fact:
sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: "{{ register_ibmcloud_power_iaas_workspace_service_instance.resource.crn }}"
sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: "{{ __sap_vm_provision_task_ibmcloud_pi_workspace_service_instance.resource.crn }}"
sap_ha_pacemaker_cluster_ibmcloud_api_key: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}"
sap_ha_pacemaker_cluster_ibmcloud_region: "{{ list_ibmcloud_powervs_location_to_powervs_region[sap_vm_provision_ibmcloud_powervs_location] }}" # Lookup IBM Power VS Region from the given IBM Power VS Location during sap_vm_provision execution
when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ansible.builtin.set_fact:
host_node_scaleout_origin_spec: "{{ ansible_hostname | regex_replace('^(.+?)\\d*$', '\\1') }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
- not inventory_hostname in vars[ansible_prompt_iac_platform_choice + '_host_specifications_dictionary'][sap_vm_provision_host_specification_plan].keys()

# Use inventory_hostname_short to retrieve host specification from the dictionary. While ansible_hostname will work for Ansible only, using Ansible>Terraform may see ansible_hostname as 'localhost' and fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- name: Ansible Play for controlling execution to an Infrastructure Platform when SAP HANA Scale-Out is used
when:
- (groups["hana_primary"] is defined and (groups["hana_primary"] | length>0)) and (sap_hana_scaleout_active_coordinator is defined or sap_hana_scaleout_active_worker is defined or sap_hana_scaleout_standby is defined)
- (groups["hana_primary"] is defined and (groups["hana_primary"] | length>0)) and (sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined or sap_vm_provision_calculate_sap_hana_scaleout_active_worker is defined or sap_vm_provision_calculate_sap_hana_scaleout_standby is defined)
block:

# Required to collect the remote host's facts for further processing
Expand Down Expand Up @@ -35,7 +35,7 @@
loop_control:
label: "{{ inventory_hostname_short }}"
when:
- (sap_hana_scaleout_standby == 0) or (not sap_hana_scaleout_standby is defined)
- (sap_vm_provision_calculate_sap_hana_scaleout_standby == 0) or (not sap_vm_provision_calculate_sap_hana_scaleout_standby is defined)

- name: Update /etc/hosts file for SAP HANA Scale-Out Active Workers (with Standby)
ansible.builtin.lineinfile:
Expand All @@ -46,7 +46,7 @@
- "# SAP HANA scale-out workers\n{% for host in (groups['hana_primary'] | reject('search', '0') | list)[:-1] %}{% if (host != inventory_hostname_short) %}{{ hostvars[host]['ansible_host'] }}\t{{ hostvars[host]['ansible_fqdn'] }}\t{{ hostvars[host]['inventory_hostname_short'] }}\n{% endif %}{% endfor %}"
loop_control:
label: "{{ inventory_hostname_short }}"
when: sap_hana_scaleout_standby > 0
when: sap_vm_provision_calculate_sap_hana_scaleout_standby > 0

- name: Update /etc/hosts file for SAP HANA Scale-Out Standby
ansible.builtin.lineinfile:
Expand All @@ -58,5 +58,5 @@
loop_control:
label: "{{ inventory_hostname_short }}"
when:
- sap_hana_scaleout_standby > 0
- sap_vm_provision_calculate_sap_hana_scaleout_standby > 0
- not inventory_hostname_short == hostvars[(groups['hana_primary'] | last)]['inventory_hostname_short']
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
file: common/set_ansible_vars.yml

- name: Ansible AWS Route53 DNS Records for hosts
register: __sap_vm_provision_task_route53
register: __sap_vm_provision_task_aws_route53
no_log: "{{ __sap_vm_provision_no_log }}"
amazon.aws.route53:
state: present
Expand Down Expand Up @@ -100,7 +100,7 @@
- __sap_vm_provision_task_provision_host_single_volumes
- __sap_vm_provision_task_provision_host_all_add
- __sap_vm_provision_task_aws_vpc_subnet_rt_info
- __sap_vm_provision_task_route53
- __sap_vm_provision_task_aws_route53
loop_control:
loop_var: loop_item
index_var: loop_item_index
Expand Down Expand Up @@ -144,7 +144,7 @@
ansible.builtin.include_tasks:
file: common/set_etc_hosts_scaleout.yml
when:
- (groups["hana_primary"] is defined and (groups["hana_primary"] | length>0)) and (sap_hana_scaleout_active_coordinator is defined or sap_hana_scaleout_active_worker is defined or sap_hana_scaleout_standby is defined)
- (groups["hana_primary"] is defined and (groups["hana_primary"] | length>0)) and (sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined or sap_vm_provision_calculate_sap_hana_scaleout_active_worker is defined or sap_vm_provision_calculate_sap_hana_scaleout_standby is defined)

- name: Set vars for sap_storage_setup Ansible Role
register: __sap_vm_provision_task_ansible_vars_storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ansible.builtin.set_fact:
scaleout_origin_host_spec: "{{ inventory_hostname | regex_replace('^(.+?)\\d*$', '\\1') }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
- not inventory_hostname in lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys()

- name: Provision AWS EC2 Virtual Server instance
Expand Down
Loading

0 comments on commit 713e13b

Please sign in to comment.