-
Notifications
You must be signed in to change notification settings - Fork 4
/
pre-req.yaml
84 lines (76 loc) · 2.54 KB
/
pre-req.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- hosts: localhost
gather_facts: true
become: true
vars:
setup_path: "~"
helm_version: v3.12.3
gcloud_version: 445.0.0
gcloud_source_repo: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads
install_helm: false
install_pip: false
install_gcloud: false
environment:
CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
tasks:
- name: Check Distribution
set_fact:
distro: "{{ 'linux' if (ansible_system == 'Linux') else 'darwin' }}"
helm_arch: "{{ 'amd64' if (ansible_architecture == 'x86_64') else 'arm64' }}"
gcloud_arch: "{{ ansible_architecture }}"
- name: Show Distribution
debug:
msg: "{{ distro }} & {{ helm_arch }} & {{gcloud_arch}}"
- name: Install multi python packages with version specifiers
ansible.builtin.pip:
name:
- requests==2.25.1
when: "install_pip"
- name: Install helm if not exists
unarchive:
src: "https://get.helm.sh/helm-{{ helm_version }}-{{ distro }}-{{ helm_arch }}.tar.gz"
dest: /usr/local/bin
extra_opts: "--strip-components=1"
owner: root
group: root
mode: 0755
remote_src: true
args:
creates: /usr/local/bin/helm
when: "install_helm"
- name: Create gcloud-sdk directory
file:
path: "{{ setup_path }}/google-cloud-sdk"
state: directory
when: "install_gcloud"
- name: Extract gcloud archive
unarchive:
src: "{{gcloud_source_repo}}/google-cloud-cli-{{gcloud_version}}-{{distro}}-{{gcloud_arch}}.tar.gz"
dest: "{{ setup_path }}/google-cloud-sdk"
remote_src: true
when: "install_gcloud"
- name: Install gcloud-cli
shell: >
"{{ setup_path }}/google-cloud-sdk/google-cloud-sdk/install.sh"
register: command_result
when: "install_gcloud"
- name: ls
shell: >
ls $HOME
register: ls_result
# when: "install_gcloud"
- debug:
msg: "{{ ls_result }}"