-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy.yaml
48 lines (41 loc) · 1.95 KB
/
deploy.yaml
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
---
- name: "Deploy Rocket.Chat.Audit"
vars_files:
- config.yml
hosts: "{{ env }}"
remote_user: "{{ remote_user }}"
become: true
tasks:
- name: "Ensure directories exist with correct permissions"
file: path={{ item }} state=directory owner={{ user }} group={{ group }} mode=0755
with_items:
- "{{ deploy_dir }}"
- "{{ log_dir }}"
- name: "Install python dependencies"
apt: name={{ item }} state=present
with_items:
- python-setuptools
- python-pip
- name: "Copy rocketchat.audit dependencies"
copy: src=../requirements.txt dest=/tmp/requirements.txt
- name: "Install rocketchat.audit dependencies"
pip: requirements=/tmp/requirements.txt state=present
- name: "Deploy rocketchat.audit service"
copy: src=../rocketchat.audit.py dest={{ deploy_dir }}/rocketchat.audit.py owner={{ user }} group={{ group }} mode=0755
notify:
- restart rocketchat.audit cron
- name: "Deploy rocketchat.audit upstart"
template: src=rocketchat.audit.conf.j2 dest=/etc/init/rocketchat.audit.conf
- name: "Deploy rocketchat.audit inspector"
copy: src=../inspector.py dest={{ deploy_dir }}/inspector.py owner={{ user }} group={{ group }} mode=0755
- name: "Configure rocketchat.audit crontab"
cron: name=rocketchat.audit user={{ user }}
minute={{ crontab.split(' ')[0] }} hour={{ crontab.split(' ')[1] }}
day={{ crontab.split(' ')[2] }} month={{ crontab.split(' ')[3] }}
weekday={{ crontab.split(' ')[4] }}
job="{{ deploy_dir }}/inspector.py {% if cron_verbosity > 0 %}-{% for n in range(cron_verbosity) %}v{% endfor %}{% endif %} --time=-24h --from={{ from_email }} email {{ audit_email }} &> {{ log_dir }}/cron.log"
- name: "Configure rocketchat.audit sudoers"
template: src=rocketchat.audit.sudoers.j2 dest=/etc/sudoers.d/rocketchat-audit owner=root group=root mode=0440
handlers:
- name: restart rocketchat.audit
service: name=rocketchat.audit state=restarted