Update local-docker
[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         update_cache: yes
194         state: fixed
195       become: true
196       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
197
198     - name: Install npm and addon packages
199       apt:
200         name:
201           - nodejs
202           - npm
203           - node-gyp
204         update_cache: yes
205         state: fixed
206       become: true
207       when: ansible_distribution == 'Ubuntu'
208
209     - name: npm self-update
210       command: npm install npm@{{ npm_version }} -g
211       become: true
212       when: ansible_distribution == 'Ubuntu'
213
214     - name: npm install n module
215       command: npm install n -g
216       become: true
217       when: ansible_distribution == 'Ubuntu'
218
219     - name: Upgrade latest stable node version
220       command: n stable | PATH="$PATH"
221       become: true
222       when: ansible_distribution == 'Ubuntu'
223
224     - name: Add Google Chrome key
225       apt_key:
226         url: https://dl-ssl.google.com/linux/linux_signing_key.pub
227         state: present
228       become: true
229       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
230
231     - name: Add Google Chrome repo
232       copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{apt_file}} owner=root group=root mode=644
233       become: true
234       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
235
236     - name: Update apt cache
237       apt: update_cache=yes
238       become: true
239       when: ansible_distribution == 'Ubuntu'
240
241     - name: Install Google Chrome
242       apt:
243         name: google-chrome-stable
244         state: present
245       become: true
246       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
247
248     - name: Install Erlang dependency packages
249       apt:
250         name:
251           - libwxgtk3.0-0v5
252           - libsctp1
253           - libwxbase3.0-0v5
254       become: true
255       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
256
257     - name: Install Erlang
258       apt:
259         deb: https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_19.3.6-1~ubuntu~trusty_amd64.deb
260       become: true
261       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
262
263     - name: 'Download latest rebar3 bin'
264       command: curl -o /usr/bin/rebar3 -L "https://s3.amazonaws.com/rebar3/rebar3"
265       become: true
266       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
267
268     - file:
269         path: /usr/bin/rebar3
270         mode: "+x"
271       become: true
272       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
273
274     - name: Download geckodriver
275       unarchive:
276         src: https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
277         dest: /usr/bin
278         mode: 0755
279         remote_src: yes
280       become: true
281       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
282
283     - name: Download Firefox version 55.0.3
284       unarchive:
285         src: https://download-installer.cdn.mozilla.net/pub/firefox/releases/55.0.3/linux-x86_64/en-US/firefox-55.0.3.tar.bz2
286         dest: /opt
287         mode: 0755
288         remote_src: yes
289       become: true
290       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
291
292     - name: Create symbolic link to firefox bin
293       file:
294         src: "/opt/firefox/firefox"
295         dest: "/usr/bin/firefox"
296         state: link
297       become: true
298       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
299
300     - name: Install jinja2
301       pip:
302         name: jinja2
303         state: present
304       become: true
305       when: ansible_architecture == 'x86_64'