Skip to content

Commit f2a6477

Browse files
authored
Merge pull request #844 from yeoldegrove/gcp_cloud_sdk
gcp: install google-cloud-sdk to /opt/google-cloud-sdk
2 parents ebce662 + 9f697b2 commit f2a6477

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

salt/macros/download_from_google_storage.sls

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
# Install and configure gcloud to download files from google storage accounts
22
# https://cloud.google.com/sdk/install
33
{% macro download_from_google_storage(credentials_file, bucket_path, dest_folder) -%}
4-
{% set gcloud_dir = '/root' %}
5-
{% set gcloud_bin_dir = gcloud_dir~'/google-cloud-sdk/bin' %}
4+
{% set gcloud_inst_dir = '/opt' %}
5+
{% set gcloud_dir = gcloud_inst_dir~'/google-cloud-sdk' %}
6+
{% set gcloud_bin_dir = '/usr/local/bin' %}
67

78
install_gcloud:
89
cmd.run:
9-
- name: curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_dir }}'
10-
- unless: ls {{ gcloud_dir }}/google-cloud-sdk
10+
- name: curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_inst_dir }}'
11+
- unless: ls {{ gcloud_dir }}
1112
12-
# The next 2 states are not really needed, but it's good to have gcloud configured in any case
13-
add_gcloud_path:
14-
file.append:
15-
- name: /root/.bashrc
16-
- text: |
13+
/etc/profile.d/google-cloud-sdk.completion.sh:
14+
file.symlink:
15+
- target: {{ gcloud_dir }}/completion.bash.inc
1716
18-
# The next line updates PATH for the Google Cloud SDK.
19-
if [ -f '{{ gcloud_dir }}/google-cloud-sdk/path.bash.inc' ]; then . '{{ gcloud_dir }}/google-cloud-sdk/path.bash.inc'; fi
17+
{{ gcloud_bin_dir }}/gcloud:
18+
file.symlink:
19+
- target: {{ gcloud_dir }}/bin/gcloud
2020
21-
# The next line enables shell command completion for gcloud.
22-
if [ -f '{{ gcloud_dir }}/google-cloud-sdk/completion.bash.inc' ]; then . '{{ gcloud_dir }}/google-cloud-sdk/completion.bash.inc'; fi
23-
- require:
24-
- install_gcloud
25-
26-
restart_shell:
27-
cmd.run:
28-
- name: exec $SHELL &
29-
- require:
30-
- install_gcloud
21+
{{ gcloud_bin_dir }}/gsutil:
22+
file.symlink:
23+
- target: {{ gcloud_dir }}/bin/gsutil
3124
3225
# Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669
3326
# gcloud and gsutil don't support python3.4 usage

0 commit comments

Comments
 (0)