Add dependency libssl for Ubuntu 20.04
[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           - virtualenv
70           - more-itertools~=5.0.0
71           - zipp==1.0.0
72         state: present
73       become: true
74
75     - apt_repository:
76         repo: ppa:deadsnakes/ppa
77         state: present
78       become: true
79       when: ansible_distribution == 'Ubuntu'
80
81     - name: Update and upgrade apt packages
82       apt:
83         upgrade: 'yes'
84         update_cache: yes
85       become: true
86       when: ansible_distribution == 'Ubuntu'
87
88     - name: Install Python 3.6 and packages
89       apt:
90         name:
91           - python3.6
92           - python3.6-dev
93           - python3.6-tk
94           - libssl-dev
95           - libmysqlclient-dev
96           - gcc
97           - python3-venv
98       become: true
99       when: ansible_distribution == 'Ubuntu'
100
101     - name: Install Python 3.7
102       apt:
103         name:
104           - python3.7
105           - python3.7-dev
106           - python3.7-tk
107       become: true
108       when: ansible_distribution == 'Ubuntu'
109
110     - name: Install Python 3.8
111       apt:
112         name:
113           - python3.8
114           - python3.8-dev
115           - python3.8-tk
116       become: true
117       when: ansible_distribution == 'Ubuntu'
118
119     - name: Install Python 3.9
120       apt:
121         name:
122           - python3.9
123           - python3.9-dev
124           - python3.9-tk
125           - python3.9-distutils
126       become: true
127       when: ansible_distribution == 'Ubuntu'
128
129     - name: Install nodejs-dev libssl1.0-dev dep
130       apt:
131         name:
132           - libssl1.0-dev
133         update_cache: yes
134         state: fixed
135       become: true
136       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
137
138     - name: Install nodejs-dev dep for npm
139       apt:
140         name:
141           - nodejs-dev
142         update_cache: yes
143         state: fixed
144       become: true
145       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
146
147     - name: Install libnode-dev dep for npm
148       apt:
149         name: libnode-dev
150         update_cache: yes
151         state: fixed
152       become: true
153       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
154
155     - name: Install supporting packages (Ubuntu 18.04)
156       apt:
157         name:
158           - unzip
159           - xz-utils
160           - libxml-xpath-perl
161           - wget
162           - make
163           - sshuttle
164           - netcat
165           - libssl-dev
166           - libffi-dev
167           - xmlstarlet
168           - xvfb
169           - crudini
170           - maven
171           - python-ncclient
172         update_cache: yes
173         state: fixed
174       become: true
175       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
176
177     - name: Install supporting packages (Ubuntu 20.04)
178       apt:
179         name:
180           - unzip
181           - xz-utils
182           - libxml-xpath-perl
183           - wget
184           - make
185           - sshuttle
186           - netcat
187           - libssl-dev
188           - libffi-dev
189           - xmlstarlet
190           - xvfb
191           - crudini
192           - maven
193           - python3-ncclient
194         update_cache: yes
195         state: fixed
196       become: true
197       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
198
199     - name: Install npm and addon packages
200       apt:
201         name:
202           - nodejs
203           - npm
204           - node-gyp
205         update_cache: yes
206         state: fixed
207       become: true
208       when: ansible_distribution == 'Ubuntu'
209
210     - name: npm self-update
211       command: npm install npm@{{ npm_version }} -g
212       become: true
213       when: ansible_distribution == 'Ubuntu'
214
215     - name: npm install n module
216       command: npm install n -g
217       become: true
218       when: ansible_distribution == 'Ubuntu'
219
220     - name: Upgrade latest stable node version
221       command: n stable | PATH="$PATH"
222       become: true
223       when: ansible_distribution == 'Ubuntu'
224
225     - name: Add Google Chrome key
226       apt_key:
227         url: https://dl-ssl.google.com/linux/linux_signing_key.pub
228         state: present
229       become: true
230       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
231
232     - name: Add Google Chrome repo
233       copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{apt_file}} owner=root group=root mode=644
234       become: true
235       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
236
237     - name: Update apt cache
238       apt: update_cache=yes
239       become: true
240       when: ansible_distribution == 'Ubuntu'
241
242     - name: Install Google Chrome
243       apt:
244         name: google-chrome-stable
245         state: present
246       become: true
247       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
248
249     - name: Install Erlang dependency packages
250       apt:
251         name:
252           - libsctp1
253           - libwxbase3.0-0v5
254       become: true
255       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
256
257     - name: Install Erlang dependency package libwxgtk3 for 18.04
258       apt:
259         name:
260           - libwxgtk3.0-0v5
261       become: true
262       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
263
264     - name: Install Erlang dependency package libwxgtk3 for 20.04
265       apt:
266         name:
267           - libwxgtk3.0-gtk3-0v5
268       become: true
269       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
270
271     - name: Download and install libssl Ubuntu 20.04
272       apt:
273         deb: http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.10_amd64.deb
274       become: true
275       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
276
277     - name: Install Erlang
278       apt:
279         deb: https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_19.3.6-1~ubuntu~trusty_amd64.deb
280       become: true
281       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
282
283     - name: 'Download latest rebar3 bin'
284       command: curl -o /usr/bin/rebar3 -L "https://s3.amazonaws.com/rebar3/rebar3"
285       become: true
286       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
287
288     - file:
289         path: /usr/bin/rebar3
290         mode: "+x"
291       become: true
292       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
293
294     - name: Download geckodriver
295       unarchive:
296         src: https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
297         dest: /usr/bin
298         mode: 0755
299         remote_src: yes
300       become: true
301       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
302
303     - name: Download Firefox version 55.0.3
304       unarchive:
305         src: https://download-installer.cdn.mozilla.net/pub/firefox/releases/55.0.3/linux-x86_64/en-US/firefox-55.0.3.tar.bz2
306         dest: /opt
307         mode: 0755
308         remote_src: yes
309       become: true
310       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
311
312     - name: Create symbolic link to firefox bin
313       file:
314         src: "/opt/firefox/firefox"
315         dest: "/usr/bin/firefox"
316         state: link
317       become: true
318       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
319
320     - name: Install jinja2
321       pip:
322         name: jinja2
323         state: present
324       become: true
325       when: ansible_architecture == 'x86_64'