3674624a449254a06622b81b3e3530f2162e54a6
[releng/builder.git] / packer / provision / helm.yaml
1 ---
2 - import_playbook: ../common-packer/provision/docker.yaml
3
4 - hosts: all
5   become_user: root
6   become_method: sudo
7
8   vars:
9     kubectl_version: 1.22.4
10     helm_version: 2.16.6
11     helm3_3_version: 3.3.4
12     helm3_5_version: 3.5.1
13     helm3_7_version: 3.7.1
14     chartmuseum_version: 0.12.0
15
16   tasks:
17     - name: "Install kubectl {{kubectl_version}}"
18       get_url:
19         url: "https://storage.googleapis.com/kubernetes-release/release/v{{kubectl_version}}/bin/linux/amd64/kubectl"
20         dest: /usr/local/bin/kubectl
21         mode: 0775
22       become: yes
23
24     - name: "Install Helm {{helm_version}}"
25       block:
26         - name: "Fetch tar.gz for {{helm_version}}"
27           get_url:
28             url: "https://get.helm.sh/helm-v{{helm_version}}-linux-amd64.tar.gz"
29             dest: "/tmp/helm-v{{helm_version}}-linux-amd64.tar.gz"
30         - name: "Unarchive {{helm_version}}"
31           unarchive:
32             src: "/tmp/helm-v{{helm_version}}-linux-amd64.tar.gz"
33             dest: /tmp
34             remote_src: true
35           become: yes
36         - name: "Move {{helm_version}} bin to /usr/local/bin and set as executable"
37           command: "mv /tmp/linux-amd64/helm /usr/local/bin/helm"
38           become: yes
39         - name: "Check Helm {{helm_version}}"
40           command: "which helm"
41
42     - name: "Install Helm 3.3 {{helm3_3_version}}"
43       block:
44         - name: "Create directory /tmp/helm3_3"
45           file:
46             path: /tmp/helm3_3
47             state: directory
48         - name: "Fetch tar.gz for Helm 3.3"
49           get_url:
50             url: "https://get.helm.sh/helm-v{{helm3_3_version}}-linux-amd64.tar.gz"
51             dest: /tmp/helm3_3
52         - name: "Unarchive Helm 3.3"
53           unarchive:
54             src: "/tmp/helm3_3/helm-v{{helm3_3_version}}-linux-amd64.tar.gz"
55             dest: /tmp/helm3_3
56             remote_src: true
57           become: yes
58         - name: "Move Helm 3.3 bin to /usr/local/bin and set as executable"
59           command: "mv /tmp/helm3_3/linux-amd64/helm /usr/local/bin/helm3.3"
60           become: yes
61         - name: "Check Helm 3.3"
62           command: "which helm3.3"
63         - name: "Check kubectl {{kubectl_version}}"
64           command: "which kubectl"
65
66         - name: "Install Helm 3.3"
67           shell: |
68             echo "----> Installing helm 3.3"
69             wget 'https://get.helm.sh/helm-v{{helm3_3_version}}-linux-amd64.tar.gz'
70             tar -xvf 'https://get.helm.sh/helm-v{{helm3_3_version}}-linux-amd64.tar.gz'
71             mv linux-amd64/helm /usr/local/bin/helm3.3
72             which helm3.3
73           become: true
74
75     - name: "Install Helm3.5 {{helm3_5_version}}"
76       block:
77         - name: "Create directory /tmp/helm3.5"
78           file:
79             path: /tmp/helm3.5
80             state: directory
81         - name: "Fetch tar.gz for Helm 3.5"
82           get_url:
83             url: "https://get.helm.sh/helm-v{{helm3_5_version}}-linux-amd64.tar.gz"
84             dest: /tmp/helm3.5
85         - name: "Unarchive Helm 3.5"
86           unarchive:
87             src: "/tmp/helm3.5/helm-v{{helm3_5_version}}-linux-amd64.tar.gz"
88             dest: /tmp/helm3.5
89             remote_src: true
90           become: yes
91         - name: "Move Helm 3.5 bin to /usr/local/bin and set as executable"
92           command: "mv /tmp/helm3.5/linux-amd64/helm /usr/local/bin/helm3.5"
93           become: yes
94         - name: "Check Helm 3.5"
95           command: "which helm3.5"
96         - name: "Check kubectl {{kubectl_version}}"
97           command: "which kubectl"
98         - name: "Install Helm 3.5"
99           shell: |
100             echo "----> Installing helm3.5"
101             wget 'https://get.helm.sh/helm-v{{helm3_5_version}}-linux-amd64.tar.gz'
102             tar -xvf 'https://get.helm.sh/helm-v{{helm3_5_version}}-linux-amd64.tar.gz'
103             mv linux-amd64/helm /usr/local/bin/helm3.5
104             which helm3.5
105           become: true
106
107     - name: "Install Helm3.7 {{helm3_7_version}}"
108       block:
109         - name: "Create directory /tmp/helm3.7"
110           file:
111             path: /tmp/helm3.7
112             state: directory
113         - name: "Fetch tar.gz for Helm 3.7"
114           get_url:
115             url: "https://get.helm.sh/helm-v{{helm3_7_version}}-linux-amd64.tar.gz"
116             dest: /tmp/helm3.7
117         - name: "Unarchive Helm 3.7"
118           unarchive:
119             src: "/tmp/helm3.7/helm-v{{helm3_7_version}}-linux-amd64.tar.gz"
120             dest: /tmp/helm3.7
121             remote_src: true
122           become: yes
123         - name: "Move Helm 3.7 bin to /usr/local/bin and set as executable"
124           command: "mv /tmp/helm3.7/linux-amd64/helm /usr/local/bin/helm3.7"
125           become: yes
126         - name: "Check Helm 3.7"
127           command: "which helm3.7"
128         - name: "Check kubectl {{kubectl_version}}"
129           command: "which kubectl"
130         - name: "Install Helm 3.7"
131           shell: |
132             echo "----> Installing helm3.7"
133             wget 'https://get.helm.sh/helm-v{{helm3_7_version}}-linux-amd64.tar.gz'
134             tar -xvf 'https://get.helm.sh/helm-v{{helm3_7_version}}-linux-amd64.tar.gz'
135             mv linux-amd64/helm /usr/local/bin/helm3.7
136             which helm3.7
137           become: true
138
139     - name: "Install ChartMuseum {{chartmuseum_version}}"
140       block:
141         - name: "Fetch bin for ChartMuseum"
142           get_url:
143             url: "https://s3.amazonaws.com/chartmuseum/release/v{{ chartmuseum_version }}/bin/linux/amd64/chartmuseum"
144             dest: /usr/local/bin/chartmuseum
145             mode: "0755"
146           become: yes
147         - name: "Check ChartMuseum {{chartmuseum_version}}"
148           command: "which chartmuseum"