|
1 | 1 | # Install and configure gcloud to download files from google storage accounts |
2 | 2 | # https://cloud.google.com/sdk/install |
3 | 3 | {% 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' %} |
6 | 7 |
|
7 | 8 | install_gcloud: |
8 | 9 | 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 }} |
11 | 12 |
|
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 |
17 | 16 |
|
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 |
20 | 20 |
|
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 |
31 | 24 |
|
32 | 25 | # Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669 |
33 | 26 | # gcloud and gsutil don't support python3.4 usage |
|
0 commit comments