-
Notifications
You must be signed in to change notification settings - Fork 5
/
staticman.yml
83 lines (73 loc) · 2.48 KB
/
staticman.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
---
- hosts: production
remote_user: "{{ admin_user }}"
handlers:
- name: reload supervisor
shell: "service supervisor restart; supervisorctl reload"
become: yes
- name: restart app
shell: "supervisorctl restart staticman"
become: yes
roles:
- role: chesterbr.vault
- role: chesterbr.nginx
nginx_sites:
- server:
file_name: staticman.chester.me
root: "{{ staticman_checkout_dir }}/public"
server_name: staticman.chester.me
https_server_name: staticman.chester.me
location1: { name: '~ .*', proxy_pass: 'http://staticman_node' }
- role: geerlingguy.certbot
tags: certbot
become: yes
certbot_create_if_missing: true
certbot_auto_renew: true
certbot_auto_renew_user: root
certbot_admin_email: "{{ admin_email }}"
certbot_certs:
- domains:
- staticman.chester.me
tasks:
- name: Install prereq packages
apt: name={{ packages }} state=present
become: yes
vars:
packages:
- git
- nodejs
- npm
- supervisor
- name: Add staticman upstream to server config
become: yes
lineinfile: dest=/etc/nginx/sites-enabled/staticman.chester.me insertbefore="BOF" line="upstream staticman_node { server 127.0.0.1:3002; }"
notify:
- reload nginx
- name: Ensure code repository is at latest version
git: repo=https://github.com/chesterbr/staticman
accept_hostkey=true
dest={{ staticman_checkout_dir }}
version=master
notify: restart app
become: yes
become_user: "{{ server_user }}"
tags:
- update_app
- name: Ensure we have all node dependencies for staticman
command: bash -lc "cd {{ staticman_checkout_dir }}; npm install"
changed_when: false
become: yes
become_user: "{{ server_user }}"
tags:
- update_app
- name: Copies staticman infrastructure configuration
template: src=templates/staticman_infrastructure_config.json.j2 dest={{ staticman_checkout_dir }}/config.production.json
become: yes
become_user: "{{ server_user }}"
notify: reload supervisor
- name: Configures staticman to run under supervisor (from source dir)
template: src=templates/staticman.conf.supervisor.j2 dest=/etc/supervisor/conf.d/staticman.conf
become: yes
notify: reload supervisor
tags:
- configure_supervisor