Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ansible #655

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
f7bf5d3
Bring in the manual updates
May 25, 2024
a954b1f
Fixing Merge conflicts
May 25, 2024
fc4f91f
Fix Linting
May 25, 2024
08eebc1
Pacemaker changes, saptune and NAT Gateway (#583)
hdamecharla May 28, 2024
8eea367
Fix regex necessary to comment lines in /usr/sap/sapservices (#584)
daradicscsaba May 28, 2024
3e0f641
remove duplicate resource
May 29, 2024
50402b9
Fix path
May 29, 2024
4b831bf
chore: Fix the count for the table resource
May 30, 2024
13a0adb
Misc fixes
May 30, 2024
12d6426
Fix systemd service reload in 1.4 Packages role
hdamecharla May 30, 2024
f960bbd
Various Terraform code fixes (#586)
daradicscsaba May 30, 2024
5d071db
chore: Update count condition in dns.tf for local private DNS usage
May 30, 2024
90c8833
chore: Update NAT Gateway public IP name format
hdamecharla May 30, 2024
5ffb096
chore: Update NAT Gateway public IP lifecycle configuration
hdamecharla May 31, 2024
1e9e55f
chore: Update NAT Gateway provider to azureng
hdamecharla May 31, 2024
b954e28
chore: Fix typo in azureng provider configuration alias in sap_landsc…
hdamecharla May 31, 2024
e39ef39
chore: Update NAT Gateway provider to azurerm.main
hdamecharla May 31, 2024
300206c
Update 01-deploy-control-plane.yaml
nnoaman May 31, 2024
a851954
chore: Update app_service_plan name format in sap_deployer module
May 31, 2024
2ba8a1c
Merge branch 'experimental' of https://github.com/Azure/sap-automatio…
May 31, 2024
8b1e356
Update ARM_CLIENT_SECRET assignment in deploy control plane pipeline
May 31, 2024
8cdf651
Add the compliance extensions also to the deployers
May 31, 2024
8d84bba
Ensure that custom_logical_volumes can be striped + have sensible str…
SteffenBoThomsen Jun 3, 2024
3b44b9e
Update AMS provider creation tasks in ansible playbook
devanshjainms Jun 4, 2024
dfeb7e4
Merge pull request #590 from devanshjainms/devanshjain/ams-login-bugfix
nnoaman Jun 4, 2024
237c1fd
Update deploy control plane pipeline to use service principal for aut…
hdamecharla Jun 6, 2024
0e1967e
chore: Temporarily set identity type to "SystemAssigned, UserAssigned…
hdamecharla Jun 6, 2024
ac55a29
Various Ansible fixes (#591)
daradicscsaba Jun 7, 2024
e70bc59
chore: Adjust Azure fence agent packages and remove unused Azure Pyth…
hdamecharla Jun 11, 2024
877dc61
chore: Override changed status for saptune_check and active_saptune_…
hdamecharla Jun 11, 2024
e2b910e
chore: Add condition to check if saptune_solution_enabled is defined …
hdamecharla Jun 11, 2024
df49b8d
chore: Add condition to check if saptune_solution_enabled is defined …
hdamecharla Jun 11, 2024
e8cff4c
chore: Update New-SDAFDevopsWorkloadZone.ps1 script to fix variable g…
hdamecharla Jun 11, 2024
1ec39e8
chore: Refactor saptune_solution_to_apply logic in 2.10.3.yaml
hdamecharla Jun 13, 2024
064c1ab
Set HDB schema name for ABAP and JAVA systems (#593)
jesperseverinsen Jun 13, 2024
d1edf7a
chore: Comment out unnecessary role assignments in New-SDAFDevopsProj…
hdamecharla Jun 14, 2024
33f97ec
Release testing (#597)
devanshjainms Jun 19, 2024
3d2c61a
Add SAP on Azure quality chekcs feature to the 05-DB-and-SAP-installa…
SteffenBoThomsen Jun 13, 2024
6a8793a
remove duplicate block
SteffenBoThomsen Jun 13, 2024
27dd64f
remove blank line
SteffenBoThomsen Jun 13, 2024
2e29558
add mode to get_url downloaded file.
SteffenBoThomsen Jun 13, 2024
a95b725
remove blank line from start of file.
SteffenBoThomsen Jun 13, 2024
0895883
Merge pull request #595 from SteffenBoThomsen/sap-on-azure-quality-ch…
devanshjainms Jun 19, 2024
ae132ee
Rename quality check to quality assurance (#600)
devanshjainms Jun 20, 2024
1b46a2e
chore: Update os-packages.yaml for redhat8.6
hdamecharla Jun 20, 2024
9684fde
chore: Create directories for SAP deployment automation
hdamecharla Jun 25, 2024
fb36046
chore: Update authentication prompt for App Registration configuration
hdamecharla Jun 26, 2024
2882b0b
chore: Update PostBuildCleanup task to version 4 in 01-deploy-control…
hdamecharla Jun 27, 2024
d46a2b7
chore: Update PostBuildCleanup task to version 4 for all stages in 01…
hdamecharla Jun 27, 2024
ff51fe5
chore: Update PostBuildCleanup task to version 4 in deploy pipelines
hdamecharla Jun 27, 2024
e13031d
chore: Update clusterPrep-RedHat.yml to avoid resource discovery duri…
hdamecharla Jun 27, 2024
ced537b
Do not fail on saptune solution verify (#602)
SteffenBoThomsen Jul 2, 2024
e86dff1
chore: Update New-SDAFDevopsProject.ps1 to use tsv output format for …
hdamecharla Jul 3, 2024
726af92
Revert "chore: Update New-SDAFDevopsProject.ps1 to use tsv output for…
hdamecharla Jul 3, 2024
a1c0d65
chore: Update accelerated networking configuration in Terraform modul…
hdamecharla Jul 22, 2024
2900638
Ensure we are in the right context when getting access tokens and sub…
SteffenBoThomsen Jul 23, 2024
6c6bf6f
Fix for catching AHCO_INA_SERVICE delivery Unit import failure (#605)
jaskisin Jul 24, 2024
16070a8
Web App Component updates
Aug 1, 2024
d4a095e
Several (bug)fixes for RHEL deployments and deployments in general (#…
hjstam Aug 5, 2024
c226cf5
Update Web App to support NAT Gateway
Aug 6, 2024
29f96c6
Merge branch 'experimental' of https://github.com/Azure/sap-automatio…
Aug 6, 2024
be1849a
Hotfix release after testing with new RHEL image (#611)
devanshjainms Aug 8, 2024
3b91c6a
Update os-packages.yaml (#613)
devanshjainms Aug 9, 2024
4fc0598
chore: Refactor Azure Fencing Agent creation in 1.17 Generic Pacemake…
devanshjainms Aug 12, 2024
16667b4
Add SAP-CAL Integration for non-HA Installation (#608)
nnoaman Aug 13, 2024
7029e1b
Allow for splitting out the privatelink resources (#616)
KimForss Aug 20, 2024
1e24dd1
Extend 'root' and 'tmp' logical volumes for SAP CAL integration on RH…
nnoaman Aug 27, 2024
ab9e858
feat: Add ability to split out privatelink resources
Aug 27, 2024
bcd9da0
feat: Refactor subnet configuration to enforce private link endpoint …
Aug 27, 2024
75625c2
fix: update the management dns subscription id to saplib sub id, pin …
devanshjainms Aug 27, 2024
0df1c46
Add iSCSI NSG rule
Aug 28, 2024
7651ef0
Change rule name
Aug 28, 2024
6883a83
Add Expiry to workload zone key vault secrets
Aug 28, 2024
e79ea4a
Provide a more robust way to source the deployer subscription
Aug 28, 2024
a11ce4e
Add support for secret expiry
Aug 28, 2024
f7f5392
chore: Update keyvault set-policy command in sap-workload-zone.yaml
Aug 28, 2024
e52568d
feat: Add expiry date to secrets in key vault
Aug 28, 2024
71f6ad8
chore: Disable cross-tenant replication for sapmnt storage account
Aug 28, 2024
c19937f
chore: Update DNS configuration for sap_library module
Aug 28, 2024
117ffd3
chore: Update DNS configuration for sap_library module
Aug 28, 2024
2c77a26
chore: Update use_local_privatelink_dns condition in sap_library module
Aug 28, 2024
0a90f46
chore: Update DNS configuration for sap_library module
Aug 28, 2024
8a2f9c0
chore: Update private DNS configuration in sap_library module
Aug 28, 2024
18bc0fd
Don't create route table if Firewall is used
Aug 28, 2024
c5f271d
chore: Update key_vault.tf for sap_library module
Aug 28, 2024
4beb22a
chore: Update private DNS configuration in sap_library module
Aug 28, 2024
bf5e633
chore: Update private endpoint configuration for sapmnt storage account
Aug 28, 2024
43f4bb0
Bump up the TF version
Aug 28, 2024
fdd52fe
Also add the DB Virtual Hostname
Aug 28, 2024
1df34a4
chore: Update private endpoint configuration for sapmnt storage account
Aug 28, 2024
8ab8a02
chore: Update default value for "use_private_endpoint" to true
Aug 28, 2024
1ff26b7
Merge branch 'main' into experimental
devanshjainms Aug 28, 2024
79b1744
chore: remove extra line from 2.10.3.yaml
devanshjainms Aug 28, 2024
152e638
Update github-actions-ansible-lint.yml
KimForss Aug 28, 2024
105e7dc
chore: Update yum to dnf for Oracle RPM package installation
devanshjainms Aug 28, 2024
6757a8e
added file to set_vars
dhruvmicrosoft Sep 3, 2024
e1de050
pushing my changes
dhruvmicrosoft Sep 12, 2024
fcf1de1
pushing my changes
dhruvmicrosoft Sep 12, 2024
c5372b0
moving location of setting_vars
dhruvmicrosoft Sep 12, 2024
39fb5db
referring to the variables correctly
dhruvmicrosoft Sep 12, 2024
b97035b
created action plugins folder
dhruvmicrosoft Sep 12, 2024
198c4ab
created library folder
dhruvmicrosoft Sep 12, 2024
40d0738
removed comments
dhruvmicrosoft Sep 12, 2024
af67b20
removed comments
dhruvmicrosoft Sep 12, 2024
36e9aad
removed comments
dhruvmicrosoft Sep 12, 2024
243d307
defining variables
dhruvmicrosoft Sep 12, 2024
be13e08
registering output from setting_vars
dhruvmicrosoft Sep 12, 2024
9e2db4e
testing
dhruvmicrosoft Sep 12, 2024
192eb78
testing
dhruvmicrosoft Sep 12, 2024
948ee72
testing
dhruvmicrosoft Sep 12, 2024
449bfe4
testing
dhruvmicrosoft Sep 12, 2024
f2da13f
testing
dhruvmicrosoft Sep 13, 2024
e7d7513
testing
dhruvmicrosoft Sep 13, 2024
18a93ae
testing
dhruvmicrosoft Sep 13, 2024
e604a46
testing
dhruvmicrosoft Sep 13, 2024
be21258
testing
dhruvmicrosoft Sep 13, 2024
883dbca
testing
dhruvmicrosoft Sep 13, 2024
7ea9260
testing
dhruvmicrosoft Sep 13, 2024
8d56a2f
testing
dhruvmicrosoft Sep 13, 2024
c7a9fd2
testing
dhruvmicrosoft Sep 13, 2024
2129040
testing
dhruvmicrosoft Sep 13, 2024
84f6edf
testing
dhruvmicrosoft Sep 13, 2024
252955a
testing
dhruvmicrosoft Sep 13, 2024
a4bf717
testing
dhruvmicrosoft Sep 13, 2024
7561f3e
testing
dhruvmicrosoft Sep 13, 2024
00bf9ff
testing
dhruvmicrosoft Sep 13, 2024
618b38c
testing
dhruvmicrosoft Sep 13, 2024
2a537e9
testing
dhruvmicrosoft Sep 13, 2024
e1a4678
testing
dhruvmicrosoft Sep 13, 2024
eb31942
testing
dhruvmicrosoft Sep 13, 2024
85208cd
testing
dhruvmicrosoft Sep 13, 2024
0f06096
testing
dhruvmicrosoft Sep 13, 2024
2536153
testing
dhruvmicrosoft Sep 13, 2024
f6b6493
testing
dhruvmicrosoft Sep 13, 2024
585b9f5
testing
dhruvmicrosoft Sep 13, 2024
4cfcfab
testing
dhruvmicrosoft Sep 13, 2024
e55c761
testing
dhruvmicrosoft Sep 13, 2024
c160fbf
testing
dhruvmicrosoft Sep 13, 2024
4955292
testing
dhruvmicrosoft Sep 13, 2024
7eea804
testing
dhruvmicrosoft Sep 13, 2024
4f14d68
testing
dhruvmicrosoft Sep 13, 2024
b15753c
testing
dhruvmicrosoft Sep 13, 2024
b5cfe30
testing
dhruvmicrosoft Sep 13, 2024
1ce5a07
testing
dhruvmicrosoft Sep 14, 2024
0a79b91
testing
dhruvmicrosoft Sep 14, 2024
a266106
testing
dhruvmicrosoft Sep 14, 2024
dc53ff6
testing
dhruvmicrosoft Sep 14, 2024
930cfe7
testing
dhruvmicrosoft Sep 14, 2024
b0160ff
testing
dhruvmicrosoft Sep 15, 2024
a42fade
testing
dhruvmicrosoft Sep 15, 2024
45c6b6f
testing
dhruvmicrosoft Sep 15, 2024
caf7c5f
testing
dhruvmicrosoft Sep 15, 2024
9ff6baf
testing
dhruvmicrosoft Sep 15, 2024
b15b23d
testing
dhruvmicrosoft Sep 15, 2024
a3dfcde
testing
dhruvmicrosoft Sep 15, 2024
d8242a6
testing anf-mounts
dhruvmicrosoft Sep 16, 2024
23fc02b
testing anf-mounts
dhruvmicrosoft Sep 16, 2024
dd28578
testing anf-mounts
dhruvmicrosoft Sep 16, 2024
757192d
Merge commit 'c2535d80f111b8c13f59c910357cab21044ffcae' into refactor…
dhruvmicrosoft Sep 17, 2024
b3c2812
new pushes with oracle and simplemount
dhruvmicrosoft Oct 9, 2024
e5629e0
fixed main playbook that calls SAP Mounts
dhruvmicrosoft Oct 10, 2024
199e933
testing anf mounts
dhruvmicrosoft Oct 16, 2024
b64d780
testing anf mounts
dhruvmicrosoft Oct 16, 2024
c8aedbd
testing anf mounting
dhruvmicrosoft Oct 17, 2024
c6dec82
Bring in HotFix repairs (#651)
KimForss Oct 23, 2024
0fd2845
ansible python fix (#653)
Swatibehl Oct 24, 2024
1ce46d9
Fix conditional statement in install_workloadzone.sh
hdamecharla Oct 24, 2024
618b856
Merge branch 'development' into refactor_ansible
dhruvmicrosoft Oct 24, 2024
813c71c
added documentation
dhruvmicrosoft Oct 29, 2024
123204e
removed trailing spaces
dhruvmicrosoft Oct 29, 2024
aee9d31
removed trailing spaces
dhruvmicrosoft Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The framework uses Terraform for infrastructure deployment, and Ansible for the

## Enterprise-scale - Reference Implementation

![Ansible Lint](https://github.com/Azure/sap-automation/workflows/Ansible%20Lint/badge.svg) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/azure/sap-automation.svg)](http://isitmaintained.com/project/azure/sap-automation "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/azure/sap-automation.svg)](http://isitmaintained.com/project/azure/sap-automation "Percentage of issues still open")
![Ansible Lint](https://github.com/Azure/sap-automation/workflows/Ansible%20Lint/badge.svg) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/azure/sap-automation.svg)](http://isitmaintained.com/project/azure/sap-automation "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/azure/sap-automation.svg)](http://isitmaintained.com/project/azure/sap-automation "Percentage of issues still open") [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Azure/sap-automation/badge)](https://scorecard.dev/viewer/?uri=github.com/Azure/sap-automation)

## Partnership

Expand Down
12 changes: 6 additions & 6 deletions Webapp/SDAF/SDAFWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.9.1" />
<PackageReference Include="Azure.Identity" Version="1.12.1" />
<PackageReference Include="Azure.Identity" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager.Compute" Version="1.6.0" />
<PackageReference Include="Azure.ResourceManager.KeyVault" Version="1.3.0" />
<PackageReference Include="Azure.ResourceManager.Network" Version="1.9.0" />
<PackageReference Include="Azure.ResourceManager.Resources" Version="1.9.0" />
<PackageReference Include="Azure.ResourceManager.Storage" Version="1.3.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="6.0.33" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.5" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.2.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="3.2.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="6.0.35" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.6" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.2.2" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="3.2.2" />
<PackageReference Include="Microsoft.VisualStudio.Services.InteractiveClient" Version="19.241.0-preview" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
8 changes: 8 additions & 0 deletions deploy/ansible/roles-os/1.1-swap/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# TODO: Maybe move these to a group_vars/all/distro file so that they
# can be shared by all playbooks/tasks automatically, and extend with
# standardised versions of all similar patterns used in the playbooks.
# Changed from ansible_os_family to ansible_distribution to adopt Oracle Linux. os_family returns returns value Redhat by default.
distro_name: "{{ ansible_distribution | upper }}-{{ ansible_distribution_major_version }}"
distribution_id: "{{ ansible_distribution | lower ~ ansible_distribution_major_version }}"
distribution_full_id: "{{ ansible_distribution | lower ~ ansible_distribution_version }}"
3 changes: 1 addition & 2 deletions deploy/ansible/roles-os/1.1-swap/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
state: latest
environment:
ZYPP_LOCK_TIMEOUT: "20"

when:
- ansible_os_family == 'Suse'
- distribution_id == 'sles_sap15'
tags:
- skip_ansible_lint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
ansible.builtin.pip:
name: passlib
state: present
vars:
ansible_python_interpreter: "python3"
tags:
- always

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""Settings Vars Module for SAP Mounts Role. This uses the AnsibleModule from the Ansible module_utils to set the parameters for the SAP mounts.
"""
from ansible.module_utils.basic import AnsibleModule

def run_module():
"""This function sets the parameters for the SAP mounts.
Input parameters are the SAP SID, HDBADM UID, platform, SIDADM UID, multi SIDs, asesidadm_uid(not required), SCS instance number, PAS instance number, APP instance number, server name and distribution full ID(not required).
The output parameters are the SID, all_sap_mounts, first_server_temp, mnt_options and nfs_service.
"""
distro_versions = [
"redhat8.4",
"redhat8.6",
"redhat8.8",
"redhat9.0",
"redhat9.2",
"sles_sap15.2",
"sles_sap15.3",
"sles_sap15.4",
"sles_sap15.5",
]
module_args = dict(
sap_sid=dict(type="str", required=True),
hdbadm_uid=dict(type="str", required=True),
platform=dict(type="str", required=True),
sidadm_uid=dict(type="str", required=True),
multi_sids=dict(type="list", required=False),
asesidadm_uid=dict(type="str", required=False),
scs_instance_number=dict(type="str", required=True),
pas_instance_number=dict(type="str", required=True),
app_instance_number=dict(type="str", required=True),
server_name=dict(type="str", required=True),
distribution_full_id=dict(type="str", required=False),
)

result = {
"this_sid": {},
"all_sap_mounts": [],
"first_server_temp": [],
"mnt_options": {},
"nfs_service": "",
}

module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)

distribution_full_id = module.params["distribution_full_id"]

result["this_sid"] = {
"sid": module.params["sap_sid"].upper(),
"dbsid_uid": module.params["hdbadm_uid"],
"sidadm_uid": (
module.params["asesidadm_uid"]
if module.params["platform"] == "SYSBASE"
else module.params["sidadm_uid"]
),
"ascs_inst_no": module.params["scs_instance_number"],
"pas_inst_no": module.params["pas_instance_number"],
"app_inst_no": module.params["app_instance_number"],
}
try:
if module.params["multi_sids"] is not None:
result["all_sap_mounts"] = module.params["multi_sids"]

else:
result["all_sap_mounts"].append(result["this_sid"])

except Exception as e:
module.fail_json(msg=str(e), **result)

result["first_server_temp"].append(module.params["server_name"])

result["mnt_options"] = {
"afs_mnt_options": "noresvport,vers=4,minorversion=1,sec=sys",
"anf_mnt_options": "rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys" + (",nconnect=8" if distribution_full_id in distro_versions else ""),
}

nfs_service_mapping = {
"redhat8": "nfs-server",
"redhat9": "nfs-server",
"redhat7": "nfs",
"oraclelinux8": "rpcbind",
}
result["nfs_service"] = nfs_service_mapping.get(distribution_full_id, "nfsserver")

module.exit_json(**result)

if __name__ == "__main__":
run_module()
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Settings Vars Module for SAP Mounts Oracle Role. This uses the AnsibleModule from the Ansible module_utils to set the parameters for the SAP mounts on Oracle.
"""
from ansible.module_utils.basic import AnsibleModule

def run_module():
""" This function sets the parameters for the SAP mounts on Oracle.
Input parameters are nfs_server and NFS_provider.
The output parameters are nfs_server_temp and nfs_server.
"""
module_args = dict(
nfs_server_temp=dict(type="str", required=True),
NFS_provider=dict(type="str", required=True),
)

result = {
"nfs_server_temp": [],
"nfs_server": "",
}

module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)

result["nfs_server_temp"].append(module.params["nfs_server_temp"])

module.exit_json(**result)


if __name__ == "__main__":
run_module()
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,33 @@
# | |
# +------------------------------------4--------------------------------------*/

- name: "AFS Mount: Define this SID"
ansible.builtin.set_fact:
this_sid:
{
'sid': '{{ sap_sid | upper }}',
'dbsid_uid': '{{ hdbadm_uid }}',
'sidadm_uid': '{% if platform == "SYBASE" %}{{ asesidadm_uid }}{% else %}{{ sidadm_uid }}{% endif %}',
'ascs_inst_no': '{{ scs_instance_number }}',
'pas_inst_no': '{{ pas_instance_number }}',
'app_inst_no': '{{ app_instance_number }}'
}

- name: "AFS Mount: Create list of all_sap_mounts to support "
ansible.builtin.set_fact:
all_sap_mounts: "{% if MULTI_SIDS is defined %}{{ MULTI_SIDS }}{% else %}{{ all_sap_mounts | default([]) + [this_sid] }}{% endif %}"

- name: "AFS Mount: Get the Server name list"
ansible.builtin.set_fact:
first_server_temp: "{{ first_server_temp | default([]) + [item] }}"
- name: "calling setting variables python script"
setting_vars:
sap_sid: "{{ sap_sid }}"
hdbadm_uid: "{{ hdbadm_uid }}"
platform: "{{ platform }}"
sidadm_uid: "{{ sidadm_uid }}"
multi_sids: "{{ multi_sids | default(omit) }}"
asesidadm_uid: "{{ asesidadm_uid | default(omit)}}"
scs_instance_number: "{{ scs_instance_number }}"
pas_instance_number: "{{ pas_instance_number }}"
app_instance_number: "{{ app_instance_number }}"
server_name: "{{ item }}"
with_items:
- "{{ query('inventory_hostnames', '{{ sap_sid | upper }}_SCS') }}"
- "{{ query('inventory_hostnames', '{{ sap_sid | upper }}_DB') }}"
register: setting_vars_output

- name: "AFS Mount: Set the NFSmount options"
ansible.builtin.set_fact:
afs_mnt_options: 'noresvport,vers=4,minorversion=1,sec=sys'

- name: "AFS Mount: Create list of all_sap_mounts to support"
ansible.builtin.debug:
msg:
- "List of all the SAP mounts: {{ all_sap_mounts }}"
- "First server: {{ first_server_temp }}"
verbosity: 2
msg: "TESTING list output: {{ setting_vars_output.results[0]['all_sap_mounts'] }}"
# - "List of all the SAP mounts: {{ setting_vars_output.all_sap_mounts }}"
# - "First server: {{ setting_vars_output.first_server_temp }}"

- name: Set first_server_temp to the value from setting_vars_output
ansible.builtin.set_fact:
first_server_temp: "{{ setting_vars_output.results[0]['first_server_temp'] }}"

- name: "AFS Mount: Create configuration file
with additional optimization settings"
Expand Down Expand Up @@ -89,7 +83,7 @@
src: "{{ sap_mnt }}"
path: "/saptmp"
fstype: "nfs4"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted

rescue:
Expand All @@ -106,7 +100,7 @@
src: "{{ sap_mnt }}"
path: "/saptmp"
fstype: "nfs4"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted

- name: "AFS Mount: Create SAP Directories (AFS)"
Expand All @@ -129,7 +123,7 @@
owner: '{{ item.sidadm_uid }}'
group: sapsys
mode: 0755
loop: "{{ all_sap_mounts }}"
loop: "{{ setting_vars_output.results[0]['all_sap_mounts'] }}"

- name: "AFS Mount: Unmount file systems (sapmnt)"
ansible.posix.mount:
Expand All @@ -151,14 +145,14 @@
ansible.builtin.file:
path: "/saptmp/sapmnt{{ item.sid | upper }}"
state: absent
loop: "{{ all_sap_mounts }}"
loop: "{{ setting_vars_output.results[0]['all_sap_mounts'] }}"

- name: "AFS Mount: Cleanup fstab and directory (sapmnt)"
ansible.posix.mount:
src: "{{ sap_mnt }}"
path: "/saptmp"
fstype: "nfs4"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: absent
when:
- sap_mnt is defined
Expand Down Expand Up @@ -200,7 +194,7 @@
path: "/sapmnt/{{ item.sid }}"
state: directory
register: is_created_now
loop: "{{ all_sap_mounts }}"
loop: "{{ setting_vars_output.results[0]['all_sap_mounts'] }}"

- name: "AFS Mount: Change attribute only when we create SAP Directories (sapmnt)"
ansible.builtin.file:
Expand Down Expand Up @@ -272,7 +266,7 @@
src: "{{ item.src }}"
path: "{{ item.path }}"
fstype: "{{ item.type }}"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted
loop:
- { type: 'nfs4', src: '{{ sap_mnt }}/sapmnt{{ sap_sid | upper }}', path: '/sapmnt/{{ sap_sid | upper }}' }
Expand All @@ -282,7 +276,7 @@
src: "{{ item.src }}"
path: "{{ item.path }}"
fstype: "{{ item.type }}"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: unmounted
loop:
- { type: 'nfs4', src: '{{ sap_mnt }}/sapmnt{{ sap_sid | upper }}', path: '/sapmnt/{{ sap_sid | upper }}' }
Expand All @@ -299,7 +293,7 @@
src: "{{ item.src }}"
path: "{{ item.path }}"
fstype: "{{ item.type }}"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted
loop:
- { type: 'nfs4', src: '{{ sap_mnt }}/sapmnt{{ sap_sid | upper }}', path: '/sapmnt/{{ sap_sid | upper }}' }
Expand All @@ -316,7 +310,7 @@
src: "{{ sap_mnt }}/sapmnt{{ item.sid }}"
path: "/sapmnt/{{ item.sid }}"
fstype: 'nfs4'
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted
loop: "{{ MULTI_SIDS }}"
when:
Expand All @@ -331,7 +325,7 @@
src: "{{ sap_mnt }}/sapmnt{{ sap_sid | upper }}"
path: "/sapmnt/{{ sap_sid | upper }}"
fstype: nfs4
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted
rescue:
- name: "AFS Mount: Pause for 15 seconds"
Expand All @@ -342,7 +336,7 @@
src: "{{ sap_mnt }}/sapmnt{{ sap_sid | upper }}"
path: "/sapmnt/{{ sap_sid | upper }}"
fstype: nfs4
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted

when:
Expand Down Expand Up @@ -380,7 +374,7 @@
src: "{{ item.src }}"
path: "{{ item.path }}"
fstype: "{{ item.type }}"
opts: "{{ afs_mnt_options }}"
opts: "{{ setting_vars_output.results[0]['mnt_options']['afs_mnt_options'] }}"
state: mounted

loop:
Expand All @@ -400,7 +394,7 @@
'type': 'trans',
'temppath': 'saptrans',
'mount': '{{ sap_trans }}',
'opts': '{{ afs_mnt_options }}',
'opts': '{{ setting_vars_output.results[0]["mnt_options"]["afs_mnt_options"] }}',
'path': '/usr/sap/trans',
'owner': "root",
'permissions': '0775',
Expand Down
Loading