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

Local SAS token generation as normal user #275

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 12 additions & 25 deletions ansible/playbooks/sap-hana-download-media.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
- name: SAP HANA download media
hosts: hana
remote_user: cloudadmin
become: true
become_user: root
vars:
hana_download_path: /hana/shared/install
url_timeout: 30
Expand All @@ -15,14 +13,6 @@
- name: Include external variables
ansible.builtin.include_vars: ./vars/hana_media.yaml

- name: Create software directory
ansible.builtin.file:
path: "{{ hana_download_path }}"
state: directory
owner: root
group: root
mode: 0755

- name: Retrieve account key
ansible.builtin.command: >-
az storage account keys list \
Expand Down Expand Up @@ -65,24 +55,19 @@
run_once: true
when: az_sas_token is not defined or az_sas_token == ""

- name: Download HANA media with SAS token
ansible.builtin.get_url:
url: "https://{{ az_storage_account_name }}.blob.core.windows.net/{{ az_container_name }}/{{ item }}?{{ az_sas_token }}"
dest: "{{ hana_download_path + '/' + item | split('/') | last }}"
- name: Create software directory
ansible.builtin.file:
path: "{{ hana_download_path }}"
state: directory
owner: root
group: root
mode: 0600
timeout: "{{ url_timeout }}"
register: result
until: result is succeeded
retries: "{{ url_retries_cnt }}"
delay: "{{ url_retries_delay }}"
with_items: "{{ az_blobs }}"
when: az_sas_token is defined
mode: 0755
become: true
become_user: root

- name: Download HANA media without SAS token
Copy link
Collaborator Author

@mpagot mpagot Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably no more need to support a token-less way to download the binary. On top of this there's no more way to reach this code after #264

- name: Download HANA media with SAS token
ansible.builtin.get_url:
url: "https://{{ az_storage_account_name }}.blob.core.windows.net/{{ az_container_name }}/{{ item }}"
url: "https://{{ az_storage_account_name }}.blob.core.windows.net/{{ az_container_name }}/{{ item }}?{{ az_sas_token }}"
dest: "{{ hana_download_path + '/' + item | split('/') | last }}"
owner: root
group: root
Expand All @@ -93,4 +78,6 @@
retries: "{{ url_retries_cnt }}"
delay: "{{ url_retries_delay }}"
with_items: "{{ az_blobs }}"
when: az_sas_token is not defined
become: true
become_user: root
when: az_sas_token is defined
6 changes: 4 additions & 2 deletions ansible/playbooks/tasks/cluster-bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@
register: stonith_config_result
failed_when: "'ERROR' in stonith_config_result.stderr"

# Thee following STONITH commands for GCP have been adapted from
# https://cloud.google.com/solutions/sap/docs/sap-hana-ha-config-sles
# The following STONITH commands for GCP have been adapted from
# https://cloud.google.com/solutions/sap/docs/sap-hana-ha-config-sles#create_the_fencing_device_resources
- name: Configure GCP Native Fencing STONITH for Primary
ansible.builtin.command: >
crm configure primitive rsc_gce_stonith_primary stonith:fence_gce
Expand All @@ -287,6 +287,8 @@
- is_primary
- not (use_sbd | bool)

# Command to configure the Secondary has to be executed on the primary
# https://cloud.google.com/solutions/sap/docs/sap-hana-ha-config-sles#create_the_fencing_device_resources
- name: Configure GCP Native Fencing STONITH for Secondary
ansible.builtin.command: >
crm configure primitive rsc_gce_stonith_secondary stonith:fence_gce
Expand Down
Loading