summaryrefslogtreecommitdiffstats
path: root/packer/provision/local-docker.yaml
blob: 32aa2c3070410a277b24f037dece241bb8e9636d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
---
- import_playbook: ../common-packer/provision/docker.yaml

- hosts: all
  become_user: root
  become_method: sudo
  vars:
    apt_file: /etc/apt/sources.list.d/google-chrome.list
    docker_compose_version: 1.29.2
    glide_checksum: sha256:c403933503ea40308ecfadcff581ff0dc3190c57958808bb9eed016f13f6f32c
    glide_version: v0.13.1
    golang_version: 1.9.1
    npm_version: "6.14.13"

  tasks:
    - name: "Checking for x86_64"
      set_fact:
        host_arch: "amd64"
        golang_checksum: sha256:07d81c6b6b4c2dcf1b5ef7c27aaebd3691cdb40548500941f92b221147c5d9c7
      when: "'x86_64' in ansible_architecture"

    - name: "Checking for aarch64"
      set_fact:
        host_arch: "arm64"
        golang_checksum: sha256:d31ecae36efea5197af271ccce86ccc2baf10d2e04f20d0fb75556ecf0614dad
      when: "'aarch64' in ansible_architecture"

    - name: 'Install Docker Compose {{docker_compose_version}}'
      command: curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-Linux-x86_64"
      become: true

    - file:
        path: /usr/local/bin/docker-compose
        mode: "+x"
      become: true

    - name: 'Install GoLang {{golang_version}}'
      block:
        - name: 'Fetch golang {{golang_version}} to /tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
          get_url:
            url: 'https://storage.googleapis.com/golang/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
            dest: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
            checksum: '{{golang_checksum}}'
        - name: 'Install golang {{golang_version}} to /usr/local'
          unarchive:
            src: '/tmp/go{{golang_version}}.linux-{{host_arch}}.tar.gz'
            dest: /usr/local
            remote_src: true
          become: true
        - name: Create symbolic link to go bin
          file:
            src: "/usr/local/go/bin/go"
            dest: "/usr/bin/go"
            state: link
          become: true

    - name: Install libxml2-utils
      apt:
        name: libxml2-utils
        state: present
      become: true
      when: ansible_distribution == 'Ubuntu'

    - apt_repository:
        repo: ppa:deadsnakes/ppa
        state: present
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Update and upgrade apt packages
      apt:
        upgrade: 'yes'
        update_cache: yes
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install Python 3.6 and packages
      apt:
        name:
          - python3.6
          - python3.6-dev
          - python3.6-tk
          - libssl-dev
          - libmysqlclient-dev
          - gcc
          - python3-venv
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install Python 3.7
      apt:
        name:
          - python3.7
          - python3.7-dev
          - python3.7-tk
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install Python 3.8
      apt:
        name:
          - python3.8
          - python3.8-dev
          - python3.8-tk
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install Python 3.9
      apt:
        name:
          - python3.9
          - python3.9-dev
          - python3.9-tk
          - python3.9-distutils
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install nodejs-dev libssl1.0-dev dep
      apt:
        name:
          - libssl1.0-dev
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'

    - name: Install nodejs-dev dep for npm
      apt:
        name:
          - nodejs-dev
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'

    - name: Install libnode-dev dep for npm
      apt:
        name: libnode-dev
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'

    - name: Install supporting packages (Ubuntu 18.04)
      apt:
        name:
          - unzip
          - xz-utils
          - libxml-xpath-perl
          - wget
          - make
          - sshuttle
          - netcat
          - libssl-dev
          - libffi-dev
          - xmlstarlet
          - xvfb
          - crudini
          - maven
          - python-ncclient
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'

    - name: Install supporting packages (Ubuntu 20.04)
      apt:
        name:
          - unzip
          - xz-utils
          - libxml-xpath-perl
          - wget
          - make
          - sshuttle
          - netcat
          - libssl-dev
          - libffi-dev
          - xmlstarlet
          - xvfb
          - crudini
          - maven
          - python3-ncclient
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'

    - name: Install npm and addon packages
      apt:
        name:
          - nodejs
          - npm
          - node-gyp
        update_cache: yes
        state: fixed
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: npm self-update
      command: npm install npm@{{ npm_version }} -g
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: npm install n module
      command: npm install n -g
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Upgrade latest stable node version
      command: n stable | PATH="$PATH"
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Add Google Chrome key
      apt_key:
        url: https://dl-ssl.google.com/linux/linux_signing_key.pub
        state: present
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Add Google Chrome repo
      copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{apt_file}} owner=root group=root mode=644
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Update apt cache
      apt: update_cache=yes
      become: true
      when: ansible_distribution == 'Ubuntu'

    - name: Install Google Chrome
      apt:
        name: google-chrome-stable
        state: present
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Install Erlang dependency packages
      apt:
        name:
          - libsctp1
          - libwxbase3.0-0v5
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Install Erlang dependency package libwxgtk3 for 18.04
      apt:
        name:
          - libwxgtk3.0-0v5
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'

    - name: Install Erlang dependency package libwxgtk3 for 20.04
      apt:
        name:
          - libwxgtk3.0-gtk3-0v5
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'

    - name: Download and install libssl Ubuntu 20.04
      apt:
        deb: http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.10_amd64.deb
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'

    - name: Install Erlang
      apt:
        deb: https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_24.1-1~ubuntu~trusty_amd64.deb
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: 'Download latest rebar3 bin'
      command: curl -o /usr/bin/rebar3 -L "https://s3.amazonaws.com/rebar3/rebar3"
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - file:
        path: /usr/bin/rebar3
        mode: "+x"
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Download geckodriver
      unarchive:
        src: https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
        dest: /usr/bin
        mode: 0755
        remote_src: yes
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Download Firefox version 55.0.3
      unarchive:
        src: https://download-installer.cdn.mozilla.net/pub/firefox/releases/55.0.3/linux-x86_64/en-US/firefox-55.0.3.tar.bz2
        dest: /opt
        mode: 0755
        remote_src: yes
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Create symbolic link to firefox bin
      file:
        src: "/opt/firefox/firefox"
        dest: "/usr/bin/firefox"
        state: link
      become: true
      when: ansible_architecture == 'x86_64' and ansible_distribution == 'Ubuntu'

    - name: Install jinja2
      pip:
        name: jinja2
        state: present
      become: true
      when: ansible_architecture == 'x86_64'