-
Notifications
You must be signed in to change notification settings - Fork 0
/
webserver.playbook.yml
executable file
·74 lines (66 loc) · 1.91 KB
/
webserver.playbook.yml
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
#!/usr/bin/env -S buildah unshare ansible-playbook
---
- name: Start NodeJS container
hosts: buildah_server
vars_files: [vars.yml]
tasks:
- name: Create NodeJS Instance
docker_container:
name: nodejs
image: node:16-alpine
command: sleep 1h
volumes:
- '{{ playbook_dir }}/galaxy:{{ tmp_path }}/galaxy'
- '{{ playbook_dir }}/.git:{{ tmp_path }}/.git'
auto_remove: yes
- name: Add NodeJS container to inventory
add_host:
name: NodeJS
ansible_connection: docker
ansible_host: nodejs
- name: Build Static Content
hosts: NodeJS
vars_files: [vars.yml]
gather_facts: false
tasks:
- name: Install system dependencies
raw: apk add --no-cache git python3 make g++
- name: Install dependencies
command: yarn install --frozen-lockfile --cwd='{{ tmp_path }}/galaxy/client'
- name: Build client
command: yarn run --cwd='{{ tmp_path }}/galaxy/client' build-production-maps
- name: Shutdown NodeJS
hosts: buildah_server
tasks:
- docker_container:
name: nodejs
state: absent
- name: Create Webserver Container
hosts: buildah_server
vars_files: [vars.yml]
roles:
- role: new_container
vars:
base_image: andarius/nginx-upload
name: "{{ containers.web.name }}"
cmd: '/entry.sh'
- name: Configure Container Environment
hosts: "{{ containers.web.name }}"
gather_facts: false
vars_files: [vars.yml]
roles: [galaxy_web]
pre_tasks:
- name: Install ansible dependencies
raw: apk {{ item }}
loop:
- update
- add --virtual build-dependencies python3
post_tasks:
- name: Clean up
raw: apk del build-dependencies
- name: Finish Galaxy Webserver Container
hosts: buildah_server
vars_files: [vars.yml]
tasks:
- name: Commit Container
command: buildah commit {{ hostvars[containers.web.name]['ansible_host'] }} {{ containers.web.name }}