data_source_description
stringclasses 1
value | input
stringlengths 19
21.6k
| license
stringclasses 1
value | module
stringclasses 219
values | output
stringlengths 2
4.69k
| path
stringlengths 8
110
| repo_name
stringclasses 9
values | repo_url
stringclasses 12
values |
---|---|---|---|---|---|---|---|
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user | ansible.builtin.set_fact | ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type | ansible.builtin.pause | ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform | ansible.builtin.pause | ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap | ansible.builtin.pause | ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts | ansible.builtin.set_fact | ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }} | ansible.builtin.include_tasks | ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision | ansible.builtin.add_host | ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist | ansible.builtin.file | ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python | ansible.builtin.package | ansible.builtin.package:
name: python3-pip
state: present
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed | ansible.builtin.package | ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python | ansible.builtin.pip | ansible.builtin.pip:
name:
- wheel
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python | ansible.builtin.pip | ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install | ansible.builtin.set_fact | ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected | deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install | ansible.builtin.set_fact | ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA | community.sap_launchpad.software_center_download | community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
- name: Execute Ansible Role sap_hana_preconfigure | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_hana_preconfigure
#### Begin SAP software installations ####
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
- name: Execute Ansible Role sap_hana_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_hana_preconfigure
#### Begin SAP software installations ####
- name: Ansible Play for SAP HANA Database Server installation
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: false
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: false
sap_install_media_detect_kernel: false
sap_install_media_detect_webdisp: false
sap_install_media_detect_db: "saphana"
# Install SAP HANA | deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
- name: Execute Ansible Role sap_hana_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_hana_preconfigure
#### Begin SAP software installations ####
- name: Ansible Play for SAP HANA Database Server installation
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect
ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: false
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: false
sap_install_media_detect_kernel: false
sap_install_media_detect_webdisp: false
sap_install_media_detect_db: "saphana"
# Install SAP HANA
- name: Execute Ansible Role sap_hana_install | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_hana_install
| deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
- name: Execute Ansible Role sap_hana_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_hana_preconfigure
#### Begin SAP software installations ####
- name: Ansible Play for SAP HANA Database Server installation
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect
ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: false
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: false
sap_install_media_detect_kernel: false
sap_install_media_detect_webdisp: false
sap_install_media_detect_db: "saphana"
# Install SAP HANA
- name: Execute Ansible Role sap_hana_install
ansible.builtin.include_role:
name: community.sap_install.sap_hana_install
- name: Ansible Play for SAP NetWeaver Application Server installation - ABAP Central Services (ASCS), Database Load, Primary Application Server (PAS)
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: true
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: true
sap_install_media_detect_kernel: true
sap_install_media_detect_webdisp: false
sap_install_media_detect_db_client: "saphana"
sap_install_media_detect_export: "sapbw4hana"
# Install SAP BW/4HANA via Ansible Role sap_swpm | deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
# Ansible Playbook for SAP BW/4HANA Sandbox installation
# Use include_role / include_tasks inside Ansible Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation.
#### Begin Infrastructure-as-Code provisioning ####
- name: Ansible Play to gather input for gathering vars and VM provisioning
hosts: localhost
gather_facts: false
# pre_tasks used only for Interactive Prompts only and can be removed without impact
pre_tasks:
- name: Playbook Interactive - Check if standard execution with an Ansible Extravars file is requested by end user
ansible.builtin.set_fact:
playbook_enable_interactive_prompts: "{{ true if (sap_vm_provision_iac_type is undefined and sap_vm_provision_iac_platform is undefined) else false }}"
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_type
ansible.builtin.pause:
prompt: "Please choose Infrastructure-as-Code automation from list - ansible , ansible_to_terraform (for existing_hosts, use Ansible standard execution with an Ansible Extravars file)"
register: sap_vm_provision_iac_type_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Provision execution - Input for sap_vm_provision_iac_platform
ansible.builtin.pause:
prompt: "Please choose Infrastructure Platform from list - aws_ec2_vs , gcp_ce_vm , ibmcloud_powervs , ibmcloud_vs , ibmpowervm_vm , kubevirt_vm , msazure_vm , ovirt_vm"
register: sap_vm_provision_iac_platform_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - SAP Deployment execution - Input for playbook_enable_default_vars_sap
ansible.builtin.pause:
prompt: "Please choose if defaults should be used for SAP Software installation (e.g. SAP System ID) - true , false"
register: playbook_enable_default_vars_sap_register
no_log: true
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Set facts from initial prompts
ansible.builtin.set_fact:
sap_vm_provision_iac_type: "{{ sap_vm_provision_iac_type_register.user_input }}"
sap_vm_provision_iac_platform: "{{ sap_vm_provision_iac_platform_register.user_input }}"
playbook_enable_default_vars_sap: "{{ playbook_enable_default_vars_sap_register.user_input }}"
when: playbook_enable_interactive_prompts
- name: Playbook Interactive - Trigger prompts for VM provisioning via {{ sap_vm_provision_iac_type }}
ansible.builtin.include_tasks: "{{ playbook_dir }}/interactive/ansible_tasks_control_inputs.yml"
when: playbook_enable_interactive_prompts
#### Provision VM ####
- name: Ansible Play to create dynamic inventory group for provisioning
hosts: localhost
gather_facts: false
tasks:
- name: Create dynamic inventory group for Ansible Role sap_vm_provision
ansible.builtin.add_host:
name: "{{ item }}"
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() }}"
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- name: Ansible Play to provision hosts for SAP
hosts: sap_vm_provision_target_inventory_group # Ansible Play target hosts pattern, use Inventory Group created by previous Ansible Task (add_host)
gather_facts: false
tasks:
- name: Execute Ansible Role sap_vm_provision
ansible.builtin.include_role:
name: community.sap_infrastructure.sap_vm_provision
when: sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
#### VM storage filesystem setup ####
- name: Ansible Play for hosts storage setup
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# 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
- name: Execute Ansible Role sap_storage_setup
ansible.builtin.include_role:
name: community.sap_install.sap_storage_setup
vars:
sap_storage_setup_sid: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_sid | default('') }}"
sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}"
sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}"
sap_storage_setup_host_type: "{{ host_specifications_dictionary[sap_vm_provision_host_specification_plan][inventory_hostname_short].sap_storage_setup_host_type | list }}"
# sap_storage_setup_definition set for the host by sap_vm_provision Ansible Role
when:
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"
- not sap_vm_provision_iac_type == "existing_hosts"
# - name: Ansible Play to execute Preflight Checks
# hosts: hana_primary
# become: true
# any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
# max_fail_percentage: 0
# tasks:
# - name: Execute Ansible Role sap_vm_preflight_checks
# ansible.builtin.include_role:
# name: community.sap_infrastructure.sap_vm_verify
#### Begin downloading SAP software installation media to hosts ####
- name: Ansible Play for preparing downloads of SAP Software installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Create directories if does not exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ sap_install_media_detect_source_directory }}"
- "{{ sap_hana_install_software_directory }}"
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Ensure OS Packages for lxml are installed
ansible.builtin.package:
name:
- python3-lxml
- libxslt-devel
- libxml2-devel
state: present
- name: Install Python dependency wheel to system Python
ansible.builtin.pip:
name:
- wheel
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml
- name: Ansible Play for downloading SAP BW/4HANA installation media
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
# Set facts based on the install dictionary and the default template selected
- name: Set fact x86_64 softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_x86_64 }}"
when:
- ansible_architecture == "x86_64"
# Set facts based on the install dictionary and the default template selected
- name: Set fact ppc64le softwarecenter_search_list_bw4hana_install
ansible.builtin.set_fact:
softwarecenter_search_list_bw4hana_install: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input].softwarecenter_search_list_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- name: Execute Ansible Module with system Python to download installation media for SAP HANA and SAP NetWeaver for hosting SAP BW/4HANA
community.sap_launchpad.software_center_download:
suser_id: "{{ sap_id_user }}"
suser_password: "{{ sap_id_user_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "{{ sap_install_media_detect_source_directory }}"
loop: "{{ softwarecenter_search_list_bw4hana_install }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed
#### Begin SAP software hosts preparation ####
- name: Ansible Play for preparing all SAP software hosts
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
- name: Execute Ansible Role sap_hana_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_hana_preconfigure
#### Begin SAP software installations ####
- name: Ansible Play for SAP HANA Database Server installation
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect
ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: false
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: false
sap_install_media_detect_kernel: false
sap_install_media_detect_webdisp: false
sap_install_media_detect_db: "saphana"
# Install SAP HANA
- name: Execute Ansible Role sap_hana_install
ansible.builtin.include_role:
name: community.sap_install.sap_hana_install
- name: Ansible Play for SAP NetWeaver Application Server installation - ABAP Central Services (ASCS), Database Load, Primary Application Server (PAS)
hosts: hana_primary
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
tasks:
- name: Execute Ansible Role sap_install_media_detect
ansible.builtin.include_role:
name: community.sap_install.sap_install_media_detect
vars:
sap_install_media_detect_swpm: true
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: true
sap_install_media_detect_kernel: true
sap_install_media_detect_webdisp: false
sap_install_media_detect_db_client: "saphana"
sap_install_media_detect_export: "sapbw4hana"
# Install SAP BW/4HANA via Ansible Role sap_swpm
- name: Execute Ansible Role sap_swpm | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_swpm
# - name: Execute Ansible Role sap_profile_update to update Profile for ICM HTTPS
# ansible.builtin.include_role:
# name: community.sap_operations.sap_profile_update
# vars:
# sap_update_profile_sid: "{{ sap_system_sid }}"
# sap_update_profile_instance_nr: "{{ sap_system_nwas_abap_pas_instance_nr }}"
# sap_update_profile_default_profile_params:
# - icm/server_port_1 = PROT=HTTPS,PORT=443$$,PROCTIMEOUT=600,TIMEOUT=3600
# sap_update_profile_instance_profile_params:
# - icm/server_port_1 = PROT=HTTPS,PORT=443$$,PROCTIMEOUT=600,TIMEOUT=3600
# - name: Execute Ansible Role sap_control to restart SAP System/s for Profile update changes
# ansible.builtin.include_role:
# name: community.sap_operations.sap_control
# vars:
# sap_control_function: "restart_all_sap" | deploy_scenarios/sap_bw4hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
- name: Ansible Play for SAP System Copy Restore
hosts: all
gather_facts: true
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
vars_prompt:
- name: ansible_prompt_sap_install_media_detect_directory
prompt: Please enter the directory path (on target) to scan for SAP Software (e.g. /software)
private: false
- name: ansible_prompt_sap_hana_backup_file_directory
prompt: Please enter the directory path (on target) containing the SAP HANA Complete Data Backup files (e.g. /software/backup_files). Ensure no trailing forward slash.
private: false
- name: ansible_prompt_sap_hana_backup_file_prefix
prompt: Please enter the prefix of the SAP HANA Complete Data Backup files (e.g. COMPLETE_DATA_BACKUP)
private: false
- name: ansible_prompt_sap_hana_backup_db_schema
prompt: Please enter the Database Schema name contained in the SAP HANA Complete Data Backup files (e.g. SAPABAP1)
private: false
- name: ansible_prompt_sap_password_override
prompt: Please enter the password to use for SAP HANA and SAP NetWeaver default users during the installation (e.g. NewPass$321)
private: true
- name: ansible_prompt_sap_password_backup_ddic000
prompt: Please enter the SAP NetWeaver Data Dictionary (DDIC) user password in Client 000 of the Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_system_hana_tenant
prompt: Please enter the SAP NetWeaver Password of user 'SYSTEM' inside the SAP HANA Tenant Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_schema
prompt: Please enter the SAP HANA Password of the database schema used in the backup file. Password is determined by backup file
private: true
- name: ansible_prompt_sap_system_type_to_restore
prompt: Please enter the SAP System type to restore from SAP HANA Complete Data Backup (saps4hana, sapecc)
private: false
- name: ansible_prompt_sap_system_version_to_restore
prompt: Please enter the SAP System version to restore from SAP HANA Complete Data Backup (1909, 2020, 2021, 2022, 2023, 6_ehp7, 6_ehp8)
private: false
- name: ansible_prompt_sap_system_id_db
prompt: Please enter desired SAP System ID for SAP HANA Database Server instance (e.g. H01)
private: false
- name: ansible_prompt_sap_system_id_instance_db
prompt: Please enter desired Instance Number for SAP HANA Database Server instance (e.g. 90)
private: false
- name: ansible_prompt_sap_system_id
prompt: Please enter desired SAP System ID for the SAP System such as SAP ECC or SAP S/4HANA (e.g. S01)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_ascs
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server ASCS instance (e.g. 00)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_pas
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server PAS instance (e.g. 01)
private: false
# Use include_role inside Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation
tasks:
- name: Set facts for all hosts | ansible.builtin.set_fact | ansible.builtin.set_fact:
sap_install_media_detect_directory: "{{ ansible_prompt_sap_install_media_detect_directory }}"
sap_hana_install_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_sidadm_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_system_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_systemdb_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_ddic_000_password: "{{ ansible_prompt_sap_password_backup_ddic000 }}"
sap_swpm_backup_system_password: "{{ ansible_prompt_sap_password_backup_system_hana_tenant }}"
sap_swpm_db_schema_abap_password: "{{ ansible_prompt_sap_password_backup_schema }}"
sap_swpm_backup_location: "{{ ansible_prompt_sap_hana_backup_file_directory }}"
sap_swpm_backup_prefix: "{{ sap_hana_backup_filename_prefix }}"
sap_swpm_db_schema_abap: "{{ ansible_prompt_sap_hana_backup_db_schema }}"
sap_hana_install_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_swpm_db_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_hana_install_instance_number: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_db_instance_nr: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_sid: "{{ ansible_prompt_sap_system_id }}"
sap_swpm_ascs_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_ascs }}"
sap_swpm_pas_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_pas }}"
sap_swpm_fqdn: "{{ ansible_domain }}"
sap_swpm_update_etchosts: 'false'
sap_swpm_db_host: "{{ ansible_hostname }}"
sap_swpm_ascs_instance_hostname: "{{ ansible_hostname }}"
| special_actions/sap_system_copy_restore_hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
- name: Ansible Play for SAP System Copy Restore
hosts: all
gather_facts: true
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
vars_prompt:
- name: ansible_prompt_sap_install_media_detect_directory
prompt: Please enter the directory path (on target) to scan for SAP Software (e.g. /software)
private: false
- name: ansible_prompt_sap_hana_backup_file_directory
prompt: Please enter the directory path (on target) containing the SAP HANA Complete Data Backup files (e.g. /software/backup_files). Ensure no trailing forward slash.
private: false
- name: ansible_prompt_sap_hana_backup_file_prefix
prompt: Please enter the prefix of the SAP HANA Complete Data Backup files (e.g. COMPLETE_DATA_BACKUP)
private: false
- name: ansible_prompt_sap_hana_backup_db_schema
prompt: Please enter the Database Schema name contained in the SAP HANA Complete Data Backup files (e.g. SAPABAP1)
private: false
- name: ansible_prompt_sap_password_override
prompt: Please enter the password to use for SAP HANA and SAP NetWeaver default users during the installation (e.g. NewPass$321)
private: true
- name: ansible_prompt_sap_password_backup_ddic000
prompt: Please enter the SAP NetWeaver Data Dictionary (DDIC) user password in Client 000 of the Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_system_hana_tenant
prompt: Please enter the SAP NetWeaver Password of user 'SYSTEM' inside the SAP HANA Tenant Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_schema
prompt: Please enter the SAP HANA Password of the database schema used in the backup file. Password is determined by backup file
private: true
- name: ansible_prompt_sap_system_type_to_restore
prompt: Please enter the SAP System type to restore from SAP HANA Complete Data Backup (saps4hana, sapecc)
private: false
- name: ansible_prompt_sap_system_version_to_restore
prompt: Please enter the SAP System version to restore from SAP HANA Complete Data Backup (1909, 2020, 2021, 2022, 2023, 6_ehp7, 6_ehp8)
private: false
- name: ansible_prompt_sap_system_id_db
prompt: Please enter desired SAP System ID for SAP HANA Database Server instance (e.g. H01)
private: false
- name: ansible_prompt_sap_system_id_instance_db
prompt: Please enter desired Instance Number for SAP HANA Database Server instance (e.g. 90)
private: false
- name: ansible_prompt_sap_system_id
prompt: Please enter desired SAP System ID for the SAP System such as SAP ECC or SAP S/4HANA (e.g. S01)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_ascs
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server ASCS instance (e.g. 00)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_pas
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server PAS instance (e.g. 01)
private: false
# Use include_role inside Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation
tasks:
- name: Set facts for all hosts
ansible.builtin.set_fact:
sap_install_media_detect_directory: "{{ ansible_prompt_sap_install_media_detect_directory }}"
sap_hana_install_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_sidadm_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_system_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_systemdb_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_ddic_000_password: "{{ ansible_prompt_sap_password_backup_ddic000 }}"
sap_swpm_backup_system_password: "{{ ansible_prompt_sap_password_backup_system_hana_tenant }}"
sap_swpm_db_schema_abap_password: "{{ ansible_prompt_sap_password_backup_schema }}"
sap_swpm_backup_location: "{{ ansible_prompt_sap_hana_backup_file_directory }}"
sap_swpm_backup_prefix: "{{ sap_hana_backup_filename_prefix }}"
sap_swpm_db_schema_abap: "{{ ansible_prompt_sap_hana_backup_db_schema }}"
sap_hana_install_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_swpm_db_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_hana_install_instance_number: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_db_instance_nr: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_sid: "{{ ansible_prompt_sap_system_id }}"
sap_swpm_ascs_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_ascs }}"
sap_swpm_pas_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_pas }}"
sap_swpm_fqdn: "{{ ansible_domain }}"
sap_swpm_update_etchosts: 'false'
sap_swpm_db_host: "{{ ansible_hostname }}"
sap_swpm_ascs_instance_hostname: "{{ ansible_hostname }}"
- name: Execute Ansible Role sap_general_preconfigure | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
| special_actions/sap_system_copy_restore_hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
||
---
- name: Ansible Play for SAP System Copy Restore
hosts: all
gather_facts: true
become: true
any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts
max_fail_percentage: 0
vars_prompt:
- name: ansible_prompt_sap_install_media_detect_directory
prompt: Please enter the directory path (on target) to scan for SAP Software (e.g. /software)
private: false
- name: ansible_prompt_sap_hana_backup_file_directory
prompt: Please enter the directory path (on target) containing the SAP HANA Complete Data Backup files (e.g. /software/backup_files). Ensure no trailing forward slash.
private: false
- name: ansible_prompt_sap_hana_backup_file_prefix
prompt: Please enter the prefix of the SAP HANA Complete Data Backup files (e.g. COMPLETE_DATA_BACKUP)
private: false
- name: ansible_prompt_sap_hana_backup_db_schema
prompt: Please enter the Database Schema name contained in the SAP HANA Complete Data Backup files (e.g. SAPABAP1)
private: false
- name: ansible_prompt_sap_password_override
prompt: Please enter the password to use for SAP HANA and SAP NetWeaver default users during the installation (e.g. NewPass$321)
private: true
- name: ansible_prompt_sap_password_backup_ddic000
prompt: Please enter the SAP NetWeaver Data Dictionary (DDIC) user password in Client 000 of the Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_system_hana_tenant
prompt: Please enter the SAP NetWeaver Password of user 'SYSTEM' inside the SAP HANA Tenant Database Schema. Password is determined by backup file
private: true
- name: ansible_prompt_sap_password_backup_schema
prompt: Please enter the SAP HANA Password of the database schema used in the backup file. Password is determined by backup file
private: true
- name: ansible_prompt_sap_system_type_to_restore
prompt: Please enter the SAP System type to restore from SAP HANA Complete Data Backup (saps4hana, sapecc)
private: false
- name: ansible_prompt_sap_system_version_to_restore
prompt: Please enter the SAP System version to restore from SAP HANA Complete Data Backup (1909, 2020, 2021, 2022, 2023, 6_ehp7, 6_ehp8)
private: false
- name: ansible_prompt_sap_system_id_db
prompt: Please enter desired SAP System ID for SAP HANA Database Server instance (e.g. H01)
private: false
- name: ansible_prompt_sap_system_id_instance_db
prompt: Please enter desired Instance Number for SAP HANA Database Server instance (e.g. 90)
private: false
- name: ansible_prompt_sap_system_id
prompt: Please enter desired SAP System ID for the SAP System such as SAP ECC or SAP S/4HANA (e.g. S01)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_ascs
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server ASCS instance (e.g. 00)
private: false
- name: ansible_prompt_sap_system_id_instance_nwas_pas
prompt: Please enter desired Instance Number for SAP NetWeaver Application Server PAS instance (e.g. 01)
private: false
# Use include_role inside Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation
tasks:
- name: Set facts for all hosts
ansible.builtin.set_fact:
sap_install_media_detect_directory: "{{ ansible_prompt_sap_install_media_detect_directory }}"
sap_hana_install_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_master_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_sidadm_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_system_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_db_systemdb_password: "{{ ansible_prompt_sap_password_override }}"
sap_swpm_ddic_000_password: "{{ ansible_prompt_sap_password_backup_ddic000 }}"
sap_swpm_backup_system_password: "{{ ansible_prompt_sap_password_backup_system_hana_tenant }}"
sap_swpm_db_schema_abap_password: "{{ ansible_prompt_sap_password_backup_schema }}"
sap_swpm_backup_location: "{{ ansible_prompt_sap_hana_backup_file_directory }}"
sap_swpm_backup_prefix: "{{ sap_hana_backup_filename_prefix }}"
sap_swpm_db_schema_abap: "{{ ansible_prompt_sap_hana_backup_db_schema }}"
sap_hana_install_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_swpm_db_sid: "{{ ansible_prompt_sap_system_id_db }}"
sap_hana_install_instance_number: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_db_instance_nr: "{{ ansible_prompt_sap_system_id_instance_db }}"
sap_swpm_sid: "{{ ansible_prompt_sap_system_id }}"
sap_swpm_ascs_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_ascs }}"
sap_swpm_pas_instance_nr: "{{ ansible_prompt_sap_system_id_instance_nwas_pas }}"
sap_swpm_fqdn: "{{ ansible_domain }}"
sap_swpm_update_etchosts: 'false'
sap_swpm_db_host: "{{ ansible_hostname }}"
sap_swpm_ascs_instance_hostname: "{{ ansible_hostname }}"
- name: Execute Ansible Role sap_general_preconfigure
ansible.builtin.include_role:
name: community.sap_install.sap_general_preconfigure
- name: Execute Ansible Role sap_netweaver_preconfigure | ansible.builtin.include_role | ansible.builtin.include_role:
name: community.sap_install.sap_netweaver_preconfigure
| special_actions/sap_system_copy_restore_hana_sandbox/ansible_playbook.yml | ansible | https://github.com/sap-linuxlab/ansible.playbooks_for_sap |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
- Downloads last month
- 55