Merge "Fix docker image build pom.xml path"
[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.17.1
10     glide_checksum: sha256:c403933503ea40308ecfadcff581ff0dc3190c57958808bb9eed016f13f6f32c
11     glide_version: v0.13.1
12     golang_version: 1.9.1
13
14   tasks:
15     - name: "Checking for x86_64"
16       set_fact:
17         host_arch: "amd64"
18         golang_checksum: sha256:07d81c6b6b4c2dcf1b5ef7c27aaebd3691cdb40548500941f92b221147c5d9c7
19       when: "'x86_64' in ansible_architecture"
20
21     - name: "Checking for aarch64"
22       set_fact:
23         host_arch: "arm64"
24         golang_checksum: sha256:d31ecae36efea5197af271ccce86ccc2baf10d2e04f20d0fb75556ecf0614dad
25       when: "'aarch64' in ansible_architecture"
26
27     - name: 'Install Docker Compose {{docker_compose_version}}'
28       command: curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-Linux-x86_64"
29       become: true
30
31     - file:
32         path: /usr/local/bin/docker-compose
33         mode: "+x"
34       become: true
35
36     - name: 'Install GoLang {{golang_version}}'
37       block:
38         - name: 'Fetch golang {{golang_version}} to /tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
39           get_url:
40             url: 'https://storage.googleapis.com/golang/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
41             dest: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
42             checksum: '{{golang_checksum}}'
43         - name: 'Install golang {{golang_version}} to /usr/local'
44           unarchive:
45             src: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
46             dest: /usr/local
47             remote_src: true
48           become: true
49         - name: Create symbolic link to go bin
50           file:
51             src: "/usr/local/go/bin/go"
52             dest: "/usr/bin/go"
53             state: link
54           become: true
55
56     - name: Install libxml2-utils
57       apt:
58         name: libxml2-utils
59         state: present
60       become: true
61       when: ansible_distribution == 'Ubuntu'
62
63     - name: Install python-tox
64       pip:
65         name: tox
66         state: present
67       become: true
68
69     - apt_repository:
70         repo: ppa:deadsnakes/ppa
71         state: present
72       become: true
73       when: ansible_distribution == 'Ubuntu'
74
75     - name: Update and upgrade apt packages
76       apt:
77         upgrade: yes
78         update_cache: yes
79       become: true
80       when: ansible_distribution == 'Ubuntu'
81
82     - name: Install Python 3.6 and packages
83       apt:
84         name:
85           - python3.6
86           - python3.6-dev
87           - python3.6-tk
88           - libssl-dev
89           - libmysqlclient-dev
90           - gcc
91       become: true
92       when: ansible_distribution == 'Ubuntu'
93
94     - name: Install Python 3.7
95       apt:
96         name:
97           - python3.7
98           - python3.7-dev
99           - python3.7-tk
100       become: true
101       when: ansible_distribution == 'Ubuntu'
102
103     - name: Install base packages
104       apt:
105         name:
106           - unzip
107           - xz-utils
108           - libxml-xpath-perl
109           - wget
110           - make
111           - npm
112           - sshuttle
113           - netcat
114           - libssl-dev
115           - libffi-dev
116       become: true
117       when: ansible_distribution == 'Ubuntu'
118
119     - name: Install autorelease support packages
120       apt:
121         name:
122           - xmlstarlet
123           - xvfb
124           - crudini
125           - maven
126           - python-ncclient
127       become: true
128       when: ansible_distribution == 'Ubuntu'
129
130     - name: Add Google Chrome key
131       apt_key:
132         url: https://dl-ssl.google.com/linux/linux_signing_key.pub
133         state: present
134       become: true
135       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
136
137     - name: Add Google Chrome repo
138       copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{apt_file}} owner=root group=root mode=644
139       become: true
140       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
141
142     - name: Update apt cache
143       apt: update_cache=yes
144       become: true
145       when: ansible_distribution == 'Ubuntu'
146
147     - name: Install Google Chrome
148       apt:
149         name: google-chrome-stable
150         state: present
151       become: true
152       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
153
154     - name: Install Erlang dependency packages
155       apt:
156         name:
157           - libwxgtk3.0-0v5
158           - libsctp1
159           - libwxbase3.0-0v5
160       become: true
161       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
162
163     - name: Install Erlang
164       apt:
165         deb: https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_19.3.6-1~ubuntu~trusty_amd64.deb
166       become: true
167       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
168
169     - name: Clone rebar3
170       git:
171         repo: 'https://github.com/erlang/rebar3.git'
172         dest: /tmp/rebar3
173       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
174
175     - name: Bootstrap rebar3
176       command: ./bootstrap
177       args:
178         chdir: /tmp/rebar3
179       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
180
181     - name: Install rebar3 to bin
182       copy:
183         src: /tmp/rebar3/rebar3
184         dest: /usr/bin/rebar3
185         mode: 0755
186         remote_src: true
187       become: true
188       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
189
190     - name: Remove unused rebar3 source
191       file:
192         path: /tmp/rebar3
193         state: absent
194       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
195
196     - name: Download geckodriver
197       unarchive:
198         src: https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
199         dest: /usr/bin
200         mode: 0755
201         remote_src: yes
202       become: true
203       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
204
205     - name: Download Firefox version 55.0.3
206       unarchive:
207         src: https://download-installer.cdn.mozilla.net/pub/firefox/releases/55.0.3/linux-x86_64/en-US/firefox-55.0.3.tar.bz2
208         dest: /opt
209         mode: 0755
210         remote_src: yes
211       become: true
212       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
213
214     - name: Create symbolic link to firefox bin
215       file:
216         src: "/opt/firefox/firefox"
217         dest: "/usr/bin/firefox"
218         state: link
219       become: true
220       when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'
221
222     - name: Install jinja2
223       pip:
224         name: jinja2
225         state: present
226       become: true
227       when: ansible_architecture == 'x86_64'