forked from Testausserveri/status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
78 lines (68 loc) · 2.37 KB
/
deploy.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
75
76
77
78
---
- hosts: all
vars_prompt:
- name: webhook
prompt: Enter the webhook
tasks:
- name: Install Docker Dependencies & other cool stuff
apt: name={{ item }} state=latest update_cache=yes
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- gpg
- git
tags: docker
- name: Get Docker key
apt_key:
url: https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg
state: present
tags: docker
# I had some problems with getting the arm64 version installed on Oracle VPS
# and this SO post helped https://stackoverflow.com/questions/58169348/how-is-the-architecture-fact-called-in-ansible/73096785#73096785
- name: Add Docker packages to Repository
vars:
deb_architecture: {
"armv6l": "armhf",
"armv7l": "armhf",
"aarch64": "arm64",
"x86_64": "amd64",
"i386": "i386"
}
apt_repository:
repo: deb [arch={{ [ansible_architecture] | map('extract', deb_architecture) | first }}] https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
tags: docker
- name: Install Docker-CE
apt: name="docker-ce" state=latest update_cache=yes
tags: docker
- name: Install docker-compose
apt: name="docker-compose" state=latest
tags: docker
- name: Enable & start docker
ansible.builtin.systemd:
name: docker
enabled: true
state: started
# this could also just copy files from current folder (on local machine) to /opt/status (remote machine)
- name: Git checkout
ansible.builtin.git:
repo: 'https://github.com/testausserveri/status.git'
dest: /opt/status
version: master
force: yes
- name: Ensure webhook is set (testausserveri)
ansible.builtin.lineinfile:
path: /opt/status/config/testausserveri/config.yaml
regexp: '^(.*)WEBHOOK_PLACEHOLDER(.*)$'
line: " webhook-url: \"{{ webhook }}\""
backrefs: yes
- name: Ensure webhook is set (members)
ansible.builtin.lineinfile:
path: /opt/status/config/members/config.yaml
regexp: '^(.*)WEBHOOK_PLACEHOLDER(.*)$'
line: " webhook-url: \"{{ webhook }}\""
backrefs: yes
- name: Start the status page
community.docker.docker_compose:
project_src: /opt/status