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

Hotfixes before release #626

Merged
merged 33 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
30264ad
Validate that the desired volume group exists before trying
Sep 3, 2024
4867472
Add Windows support for MSI Role assignment
Sep 3, 2024
5f764ab
align the MSI assignment
Sep 3, 2024
967beec
Tweak the package install order
Sep 3, 2024
850633f
Subscription ID handling
Sep 3, 2024
551af65
Skip Windows Hosts
Sep 3, 2024
045d371
Change Play and remove become
Sep 3, 2024
47228b9
Change the order of the variables
Sep 3, 2024
5aa9f26
Validate that the desired volume group exists before expanding it for…
nnoaman Sep 3, 2024
08ed025
Check both scs and ers
Sep 3, 2024
cff2417
Merge branch 'hotfix---rootvolume' of https://github.com/KimForss/sap…
Sep 3, 2024
26fec8e
Skip the location check
Sep 3, 2024
7a9cba6
Web App Updates
Sep 3, 2024
beddda0
chore: Update last modified date format in LandscapeController and Sy…
Sep 3, 2024
a13ae81
Add support for MSI
Sep 3, 2024
6309ca2
Don't install extension
Sep 3, 2024
4e554d2
chore: Set ACSS registration information in main.yaml
Sep 3, 2024
6d54a74
Save the modification date
Sep 3, 2024
6baf2be
Set missing parameters
Sep 3, 2024
0bc1049
add always tag
Sep 3, 2024
e0d9866
Use the correct object
Sep 3, 2024
4bcc67c
Use hostname to seed the UUID
Sep 3, 2024
afd2014
Linting fixes
Sep 3, 2024
5561cbc
Remove the incorrect variable
Sep 4, 2024
010c1b6
Add the -p parameter for creating the terraform cache folder
Sep 4, 2024
5f771f1
chore: Update AMS resource identifier handling in outputs.tf
Sep 4, 2024
a118626
Fix the coalesce when not using SPN
Sep 4, 2024
737e9d2
Change the logic
Sep 4, 2024
8365451
Update variables that are superseded
Sep 4, 2024
69a7cac
chore: Update script_helpers.sh to handle missing webapp client secret
Sep 4, 2024
0c87607
Precreate the cache folder
Sep 4, 2024
f63a6dd
Secret is not mandatory when using MSI
Sep 4, 2024
ee3a3d7
chore: Update NFS configuration for Red Hat 8 and 9
hdamecharla Sep 5, 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
15 changes: 12 additions & 3 deletions Webapp/SDAF/Controllers/LandscapeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public async Task<IActionResult> CreateAsync(LandscapeModel landscape)
await UnsetDefault(landscape.Id);
}
landscape.Id = Helper.GenerateId(landscape);
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.CreateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully created workload zone " + landscape.Id;
string id = landscape.Id;
Expand Down Expand Up @@ -220,7 +223,7 @@ public async Task<IActionResult> DeployAsync(string id, string partitionKey)

List<SelectListItem> environments = restHelper.GetEnvironmentsList().Result;
ViewBag.Environments = environments;


return View(landscapeView);
}
Expand Down Expand Up @@ -351,14 +354,17 @@ public async Task<IActionResult> EditAsync(LandscapeModel landscape)

await _landscapeService.CreateTFVarsAsync(file);

return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
}
else
{
if (landscape.IsDefault)
{
await UnsetDefault(landscape.Id);
}
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.UpdateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully updated workload zone " + landscape.Id;

Expand All @@ -378,7 +384,7 @@ public async Task<IActionResult> EditAsync(LandscapeModel landscape)

await _landscapeService.CreateTFVarsAsync(file);

return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
}
}
catch (Exception e)
Expand Down Expand Up @@ -408,6 +414,9 @@ public async Task<IActionResult> SubmitNewAsync(LandscapeModel landscape)
await UnsetDefault(landscape.Id);
}
landscape.Id = Helper.GenerateId(landscape);
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.CreateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully created workload zone " + landscape.Id;
string id = landscape.Id;
Expand Down
8 changes: 8 additions & 0 deletions Webapp/SDAF/Controllers/SystemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public async Task<IActionResult> CreateAsync(SystemModel system)
await UnsetDefault(system.Id);
}
system.Id = Helper.GenerateId(system);
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();
SystemEntity systemEntity = new(system);
await _systemService.CreateAsync(systemEntity);
TempData["success"] = "Successfully created system " + system.Id;
Expand Down Expand Up @@ -479,7 +481,10 @@ public async Task<IActionResult> EditAsync(SystemModel system)
system.Description = system.database_platform + " distributed system on " + system.scs_server_image.publisher + " " + system.scs_server_image.offer + " " + system.scs_server_image.sku;
}
}
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();
await _systemService.UpdateAsync(new SystemEntity(system));

TempData["success"] = "Successfully updated system " + system.Id;
string id = system.Id;
string path = $"/SYSTEM/{id}/{id}.tfvars";
Expand Down Expand Up @@ -527,6 +532,9 @@ public async Task<IActionResult> SubmitNewAsync(SystemModel system)
await UnsetDefault(system.Id);
}
system.Id = Helper.GenerateId(system);
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();

await _systemService.CreateAsync(new SystemEntity(system));
TempData["success"] = "Successfully created system " + system.Id;
return RedirectToAction("Index");
Expand Down
2 changes: 2 additions & 0 deletions Webapp/SDAF/Models/LandscapeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public bool IsValid()
[DisplayName("Workload zone ID")]
public string Id { get; set; }

public string LastModified { get; set; }

// BASIC

public bool IsDefault { get; set; } = false;
Expand Down
1 change: 1 addition & 0 deletions Webapp/SDAF/Models/SystemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public bool IsValid()

[DisplayName("System ID")]
public string Id { get; set; }
public string LastModified { get; set; }

// BASIC

Expand Down
9 changes: 9 additions & 0 deletions Webapp/SDAF/ParameterDetails/LandscapeDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
"Overrules": "",
"Display": 1
},
{
"Name": "LastModified",
"Required": false,
"Description": "System definition was modified on.",
"Type": "textbox",
"Options": [],
"Overrules": "",
"Display": 1
},
{
"Name": "save_naming_information",
"Required": false,
Expand Down
9 changes: 9 additions & 0 deletions Webapp/SDAF/ParameterDetails/SystemDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@
"Overrules": "",
"Display": 1
},
{
"Name": "LastModified",
"Required": false,
"Description": "System definition was modified on.",
"Type": "textbox",
"Options": [],
"Overrules": "",
"Display": 1
},
{
"Name": "network_logical_name",
"Required": true,
Expand Down
2 changes: 1 addition & 1 deletion Webapp/SDAF/SDAFWebApp.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<NameOfLastUsedPublishProfile>C:\Work\Repos\sap-automation\Webapp\SDAF\Properties\PublishProfiles\cpln-noeu-sapdeployment597 - Web Deploy1.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>cpln-noeu-sapdeployment597 - Web Deploy1</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Webapp/SDAF/Views/System/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>
</div>
}

<div id="form-sticky-header">
<div class="filter-checkboxes">
<fluent-checkbox checked class="parameters-filter" onchange="toggleParams(this, 1)" id="basic-filter">Basic</fluent-checkbox>
Expand Down Expand Up @@ -145,7 +145,7 @@
</td>

</tr>


</form>
</div>
14 changes: 9 additions & 5 deletions Webapp/SDAF/Views/System/Install.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,21 @@

@Html.EditorForModel("Checkbox", new { ParameterName = "database_install", DisplayName = "Database Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "scs_installation", DisplayName = "SCS Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "scs_installation", DisplayName = "SCS Installation & High Availability Configuration", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "db_load", DisplayName = "Database Load", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "high_availability_configuration", DisplayName = "SAP & DB High Availability Setup", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "high_availability_configuration", DisplayName = "Database High Availability Configuration", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "pas_installation", DisplayName = "PAS Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "pas_installation", DisplayName = "Primary Application Server Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "application_server_installation", DisplayName = "APP Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "application_server_installation", DisplayName = "Application Server Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "webdispatcher_installation", DisplayName = "WebDispatcher Installation", IsChecked = false })
@Html.EditorForModel("Checkbox", new { ParameterName = "webdispatcher_installation", DisplayName = "Web Dispatcher Installation", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "post_configuration_actions", DisplayName = "Post Configuration Actions", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "ams_provider", DisplayName = "Configure AMS Provider", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "acss_registration", DisplayName = "Register System in ACSS", IsChecked = true })

Expand Down
23 changes: 21 additions & 2 deletions deploy/ansible/playbook_06_00_acss_registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,26 @@
tags:
- 0.1-passwords

- name: "0.0 Validations - Get Access Token"
ansible.builtin.command: >-
az account get-access-token --query accessToken -o tsv
changed_when: false
register: access_token_data
no_log: true
tags:
- always

- name: "0.0 Validations - Save the access token"
ansible.builtin.set_fact:
access_token: "{{ access_token_data.stdout }}"
no_log: true
tags:
- always


# /*---------------------------------------------------------------------------8
# | |
# | Playbook for SAP Web Dispatcher Install |
# | Playbook for ASCS Registration |
# | |
# +------------------------------------4--------------------------------------*/

Expand All @@ -54,7 +71,6 @@

name: ACSS Registration
remote_user: "{{ orchestration_ansible_user }}"
become: true
gather_facts: true # Important to collect hostvars information
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
Expand Down Expand Up @@ -87,11 +103,14 @@
when:
- acssEnvironment is defined
- acssSapProduct is defined
- ansible_os_family != "Windows"
ansible.builtin.include_role:
name: "roles-misc/0.5-ACSS-registration"
vars:
acss_environment: "{{ acssEnvironment }}"
acss_sap_product: "{{ acssSapProduct }}"
acss_access_token: "{{ hostvars.localhost.access_token }}"
acss_guid: "{{ ansible_hostname | to_uuid }}"
loop: "{{ all_sids }}"
loop_control:
loop_var: sid_to_be_deployed
Expand Down
79 changes: 42 additions & 37 deletions deploy/ansible/roles-misc/0.5-ACSS-registration/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
become_user: "{{ sap_sid | lower }}adm"
become: true
when:
- "'scs' in supported_tiers"
- "'scs' in supported_tiers or 'ers' in supported_tiers"
block:
- name: "0.5.1 acss registration: - Get sapcontrol path"
ansible.builtin.find:
Expand Down Expand Up @@ -50,7 +50,7 @@

- name: "0.5.1 acss registration: - Show if SCS is running on {{ ansible_hostname }}"
ansible.builtin.debug:
var: is_running
var: is_running

- name: "0.5.1 acss registration: - Validate that SCS is running on {{ ansible_hostname }}"
ansible.builtin.set_fact:
Expand All @@ -64,30 +64,31 @@
become_user: root
when:
- hostvars[ansible_hostname]['scs_running_on'] is defined
- ansible_hostname == hostvars[ansible_hostname]['scs_running_on']
block:
- name: "0.5.1 acss registration: - Check where the cluster group g-{{ sap_sid | upper }}_{{ instance_type | upper }} is running"
ansible.builtin.shell: >-
set -o pipefail;
crm_resource --resource g-{{ sap_sid | upper }}_{{ instance_type | upper }} --locate | cut -d ':' -f 2| cut -d " " -f 2
when:
- scs_high_availability
- ansible_os_family | upper == 'SUSE'
register: cluster_group_location
failed_when: cluster_group_location.stdout != hostvars[ansible_hostname]['scs_running_on']
tags:
- skip_ansible_lint
# - name: "0.5.1 acss registration: - Check where the cluster group g-{{ sap_sid | upper }}_{{ instance_type | upper }} is running"
# ansible.builtin.shell: >-
# set -o pipefail;
# crm_resource --resource g-{{ sap_sid | upper }}_{{ instance_type | upper }} --locate | cut -d ':' -f 2| cut -d " " -f 2
# when:
# - scs_high_availability
# - ansible_os_family | upper == 'SUSE'
# register: cluster_group_location
# failed_when: cluster_group_location.stdout != hostvars[ansible_hostname]['scs_running_on']
# tags:
# - skip_ansible_lint

- name: "0.5.1 acss registration: - Check where the cluster group g-{{ sap_sid | upper }}_{{ instance_type | upper }} is running"
ansible.builtin.shell: >-
set -o pipefail;
pcs constraint location show resources g-{{ sap_sid | upper }}_{{ instance_type | upper }} | grep "Node" | awk '{print $2}'
when:
- scs_high_availability
- ansible_os_family | upper == 'REDHAT'
register: cluster_group_location
failed_when: cluster_group_location.stdout != hostvars[ansible_hostname]['scs_running_on']
tags:
- skip_ansible_lint
# - name: "0.5.1 acss registration: - Check where the cluster group g-{{ sap_sid | upper }}_{{ instance_type | upper }} is running"
# ansible.builtin.shell: >-
# set -o pipefail;
# pcs constraint location show resources g-{{ sap_sid | upper }}_{{ instance_type | upper }} | grep "Node" | awk '{print $2}'
# when:
# - scs_high_availability
# - ansible_os_family | upper == 'REDHAT'
# register: cluster_group_location
# failed_when: cluster_group_location.stdout != hostvars[ansible_hostname]['scs_running_on']
# tags:
# - skip_ansible_lint

- name: "0.5.1 acss registration: - Get Azure instance metadata"
ansible.builtin.uri:
Expand All @@ -96,21 +97,25 @@
headers:
Metadata: true
register: azure_metadata
when:
- hostvars[ansible_hostname]['scs_running_on'] is defined
- ansible_hostname == hostvars[ansible_hostname]['scs_running_on']

- name: "0.5.1 acss registration: - Set variables from Azure IMDS"
delegate_facts: true
delegate_to: localhost
ansible.builtin.command: >-
"az extension add --name workloads --yes || exit 1"
tags:
- skip_ansible_lint
- name: "Set information"
ansible.builtin.set_fact:
acss_resource_group: "{{ azure_metadata.json.compute.resourceGroupName }}"
acss_resource_id: "{{ azure_metadata.json.compute.resourceId }}"
acss_subscription_id: "{{ azure_metadata.json.compute.subscriptionId }}"
acss_location: "{{ azure_metadata.json.compute.location }}"

# - name: "0.5.1 acss registration: - Set variables from Azure IMDS"
# delegate_facts: true
# delegate_to: localhost
# ansible.builtin.command: >-
# "az extension add --name workloads --yes || exit 1"
# tags:
# - skip_ansible_lint

- name: "0.5.1 acss registration: - Create [ACSS] virtual instance"
ansible.builtin.uri:
url: "https://management.azure.com/subscriptions/{{ acss_subscription_id }}/resourceGroups/{{ acss_resource_group }}/providers/Microsoft.Workloads/sapVirtualInstances/{{ acss_sid }}?api-version=2023-04-01"
url: "https://management.azure.com/subscriptions/{{ acss_subscription_id }}/resourceGroups/{{ acss_resource_group }}/providers/Microsoft.Workloads/sapVirtualInstances/{{ sap_sid | upper }}?api-version=2023-04-01"
method: PUT
body_format: json
body: |
Expand All @@ -127,9 +132,9 @@
}
# status_code: [200, 201]
headers:
Authorization: "Bearer {{ acss_access_token.stdout }}"
Authorization: "Bearer {{ acss_access_token }}"
x-ms-rpaas-new-resource: "true"
x-ms-client-request-id: "SDAF-{{ acss_guid.stdout }}"
x-ms-client-request-id: "SDAF-{{ acss_guid }}"
register: create_vis_response
failed_when: create_vis_response.json.properties.provisioningState != 'Accepted' and create_vis_response.json.properties.provisioningState != 'Succeeded'
no_log: false
Expand Down
Loading