Chore: Update local-builder and local-packer
[ci-management.git] / packer / provision / local-docker.yaml
1 ---
2 - import_playbook: ../common-packer/provision/docker.yaml
3
4 - hosts: all
5   become_user: root
6   become_method: sudo
7   vars:
8     apt_file: /etc/apt/sources.list.d/google-chrome.list
9     docker_compose_version: 1.29.2
10     glide_checksum: sha256:c403933503ea40308ecfadcff581ff0dc3190c57958808bb9eed016f13f6f32c
11     glide_version: v0.13.1
12     golang_version: 1.9.1
13     npm_version: "6.14.13"
14
15   tasks:
16     - name: "Checking for x86_64"
17       set_fact:
18         host_arch: "amd64"
19         golang_checksum: sha256:07d81c6b6b4c2dcf1b5ef7c27aaebd3691cdb40548500941f92b221147c5d9c7
20       when: "'x86_64' in ansible_architecture"
21
22     - name: "Checking for aarch64"
23       set_fact:
24         host_arch: "arm64"
25         golang_checksum: sha256:d31ecae36efea5197af271ccce86ccc2baf10d2e04f20d0fb75556ecf0614dad
26       when: "'aarch64' in ansible_architecture"
27
28     - name: 'Install Docker Compose {{docker_compose_version}}'
29       command: curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-Linux-x86_64"
30       become: true
31
32     - file:
33         path: /usr/local/bin/docker-compose
34         mode: "+x"
35       become: true
36
37     - name: 'Install GoLang {{golang_version}}'
38       block:
39         - name: 'Fetch golang {{golang_version}} to /tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
40           get_url:
41             url: 'https://storage.googleapis.com/golang/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
42             dest: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
43             checksum: '{{golang_checksum}}'
44         - name: 'Install golang {{golang_version}} to /usr/local'
45           unarchive:
46             src: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
47             dest: /usr/local
48             remote_src: true
49           become: true
50         - name: Create symbolic link to go bin
51           file:
52             src: "/usr/local/go/bin/go"
53             dest: "/usr/bin/go"
54             state: link
55           become: true
56
57     - name: Install libxml2-utils
58       apt:
59         name: libxml2-utils
60         state: present
61       become: true
62       when: ansible_distribution == 'Ubuntu'
63
64     - name: Install python-tox and deps
65       pip:
66         name:
67           - tox
68           - tox-pyenv
69         state: present
70       become: true
71
72     - apt_repository:
73         repo: ppa:deadsnakes/ppa
74         state: present
75       become: true
76       when: ansible_distribution == 'Ubuntu'
77
78     - name: Update and upgrade apt packages
79       apt:
80         upgrade: 'yes'
81         update_cache: yes
82       become: true
83       when: ansible_distribution == 'Ubuntu'
84
85     - name: Install Python 3.6 and packages
86       apt:
87         name:
88           - python3.6
89           - python3.6-dev
90           - python3.6-tk
91           - libssl-dev
92           - libmysqlclient-dev
93           - gcc
94           - python3-venv
95       become: true
96       when: ansible_distribution == 'Ubuntu'
97
98     - name: Install Python 3.7
99       apt:
100         name:
101           - python3.7
102           - python3.7-dev
103           - python3.7-tk
104       become: true
105       when: ansible_distribution == 'Ubuntu'
106
107     - name: Install Python 3.8
108       apt:
109         name:
110           - python3.8
111           - python3.8-dev
112           - python3.8-tk
113       become: true
114       when: ansible_distribution == 'Ubuntu'
115
116     - name: Install Python 3.9
117       apt:
118         name:
119           - python3.9
120           - python3.9-dev
121           - python3.9-tk
122           - python3.9-distutils
123       become: true
124       when: ansible_distribution == 'Ubuntu'
125
126     - name: Install nodejs-dev libssl1.0-dev dep
127       apt:
128         name:
129           - libssl1.0-dev
130         update_cache: yes
131         state: fixed
132       become: true
133       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
134
135     - name: Install nodejs-dev dep for npm
136       apt:
137         name:
138           - nodejs-dev
139         update_cache: yes
140         state: fixed
141       become: true
142       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
143
144     - name: Install libnode-dev dep for npm
145       apt:
146         name: libnode-dev
147         update_cache: yes
148         state: fixed
149       become: true
150       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
151
152     - name: Install supporting packages (Ubuntu 18.04)
153       apt:
154         name:
155           - unzip
156           - xz-utils
157           - libxml-xpath-perl
158           - wget
159           - make
160           - sshuttle
161           - netcat
162           - libssl-dev
163           - libffi-dev
164           - xmlstarlet
165           - xvfb
166           - crudini
167           - maven
168           - python-ncclient
169         update_cache: yes
170         state: fixed
171       become: true
172       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
173
174     - name: Install supporting packages (Ubuntu 20.04)
175       apt:
176         name:
177           - unzip
178           - xz-utils
179           - libxml-xpath-perl
180           - wget
181           - make
182           - sshuttle
183           - netcat
184           - libssl-dev
185           - libffi-dev
186           - xmlstarlet
187           - xvfb
188           - crudini
189           - maven
190           - python3-ncclient
191         update_cache: yes
192         state: fixed
193       become: true
194       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
195
196     - name: Install npm and addon packages
197       apt:
198         name:
199           - nodejs
200           - npm
201           - node-gyp
202         update_cache: yes
203         state: fixed
204       become: true
205       when: ansible_distribution == 'Ubuntu'
206
207     - name: npm self-update
208       command: npm install npm@{{ npm_version }} -g
209       become: true
210       when: ansible_distribution == 'Ubuntu'
211
212     - name: npm install n module
213       command: npm install n -g
214       become: true
215       when: ansible_distribution == 'Ubuntu'
216
217     - name: Upgrade latest stable node version
218       command: n stable | PATH="$PATH"
219       become: true
220       when: ansible_distribution == 'Ubuntu'
221
222     - name: Add Google Chrome key
223       apt_key:
224         url: https://dl-ssl.google.com/linux/linux_signing_key.pub
225         state: present
226       become: true
227       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
228
229     - name: Add Google Chrome repo
230       copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{apt_file}} owner=root group=root mode=644
231       become: true
232       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
233
234     - name: Update apt cache
235       apt: update_cache=yes
236       become: true
237       when: ansible_distribution == 'Ubuntu'
238
239     - name: Install Google Chrome
240       apt:
241         name: google-chrome-stable
242         state: present
243       become: true
244       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
245
246     - name: Install Erlang dependency packages
247       apt:
248         name:
249           - libsctp1
250           - libwxbase3.0-0v5
251       become: true
252       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
253
254     - name: Install Erlang dependency package libwxgtk3 for 18.04
255       apt:
256         name:
257           - libwxgtk3.0-0v5
258       become: true
259       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
260
261     - name: Install Erlang dependency package libwxgtk3 for 20.04
262       apt:
263         name:
264           - libwxgtk3.0-gtk3-0v5
265       become: true
266       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
267
268     - name: Download and install libssl Ubuntu 20.04
269       apt:
270         deb: http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.10_amd64.deb
271       become: true
272       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
273
274     - name: Install Erlang
275       apt:
276         deb: https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_24.1-1~ubuntu~trusty_amd64.deb
277       become: true
278       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
279
280     - name: 'Download latest rebar3 bin'
281       command: curl -o /usr/bin/rebar3 -L "https://s3.amazonaws.com/rebar3/rebar3"
282       become: true
283       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
284
285     - file:
286         path: /usr/bin/rebar3
287         mode: "+x"
288       become: true
289       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
290
291     - name: Download geckodriver
292       unarchive:
293         src: https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
294         dest: /usr/bin
295         mode: 0755
296         remote_src: yes
297       become: true
298       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
299
300     - name: Download Firefox version 55.0.3
301       unarchive:
302         src: https://download-installer.cdn.mozilla.net/pub/firefox/releases/55.0.3/linux-x86_64/en-US/firefox-55.0.3.tar.bz2
303         dest: /opt
304         mode: 0755
305         remote_src: yes
306       become: true
307       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
308
309     - name: Create symbolic link to firefox bin
310       file:
311         src: "/opt/firefox/firefox"
312         dest: "/usr/bin/firefox"
313         state: link
314       become: true
315       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
316
317     - name: Install jinja2
318       pip:
319         name: jinja2
320         state: present
321       become: true
322       when: ansible_architecture == 'x86_64'