-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-static.yml
87 lines (87 loc) · 1.98 KB
/
deploy-static.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
79
80
81
82
83
84
85
86
87
# Compile with
# CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o uspeakd-static *.go
---
- hosts: nodes
gather_facts: yes
remote_user: root
vars:
LOG_FORMAT: 'json'
ansible_ssh_private_key_file: "~/.ssh/uspeak_ed25519"
admin_enabled: true
admin_user: 'admin'
hook_preadd: 'https://monitor.uspeak.io/handle'
tasks:
- name: disable selinux
selinux:
state: disabled
- name: install epel
yum:
name: epel-release
state: latest
- name: install nginx
package:
name: nginx
state: latest
- name: install git
package:
name: git
state: latest
- name: create deployment directory
file:
path: /opt/uspeak
state: directory
- name: create data directory
file:
path: /var/lib/uspeak/data
state: directory
- name: create configuration directory
file:
path: /etc/uspeak
state: directory
- name: write config file
template:
src: ansible/config.yml.j2
dest: /etc/uspeak/config.yml
- name: copy ssl certificate
copy:
src: cert.pem
dest: '/etc/uspeak/cert.pem'
- name: copy ssl key
copy:
src: key.pem
dest: '/etc/uspeak/key.pem'
- name: copy the uspeakd-static binary
copy:
src: uspeakd-static
dest: '/opt/uspeak/uspeakd'
force: yes
mode: 0755
- name: update service file
copy:
src: 'ansible/uspeak.service'
dest: /etc/systemd/system/
- name: clone portal repo
git:
repo: 'https://github.com/u-speak/portal.git'
dest: /opt/portal
- name: restart service
systemd:
state: restarted
daemon_reload: yes
name: uspeak
- name: copy nginx config
copy:
src: 'ansible/nginx.conf'
dest: /etc/nginx/
- name: restart nginx
systemd:
state: restarted
name: nginx
- name: enable nginx
systemd:
name: nginx
enabled: yes
- name: enable uspeak
systemd:
name: uspeak
enabled: yes