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