-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_papyrus.yml
103 lines (85 loc) · 2.66 KB
/
install_papyrus.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
- name: Install papyrus app
hosts: all
become: yes
gather_facts: yes
tasks:
- name: Adding user {{ app }} to group vagrant
user: name={{ app }}
groups=vagrant
append=yes
when: not rails_env == 'production'
- block:
- name: stat "/home/{{ app }}/{{ app }}/config/secrets.yml"
stat:
path: "/home/{{ app }}/{{ app }}/config/secrets.yml"
register: app_secrets_yml
- name: configure /vagrant/papyrus as safe for git
git_config:
name: safe.directory
scope: global
value: /vagrant/papyrus
when: rails_env != 'production' and not app_secrets_yml.stat.exists
- name: symlink /vagrant/papyrus to /home/{{ app }}/{{ app }}
file:
src: /vagrant/papyrus
dest: /home/{{ app }}/{{ app }}
state: link
when: rails_env != 'production' and not app_secrets_yml.stat.exists
become: yes
become_user: "{{ app }}"
- name: add Basic Auth to apache config
blockinfile:
path: "/etc/apache2/sites-available/{{ app }}.{{ app_domain }}.conf"
insertbefore: "</VirtualHost>"
block: "{{ lookup('file', 'templates/apache_auth_basic') }}"
notify: restart apache2
- name: add Basic Auth to apache config ssl
blockinfile:
path: "/etc/apache2/sites-available/{{ app }}.{{ app_domain }}-ssl.conf"
insertbefore: "</VirtualHost>"
block: "{{ lookup('file', 'templates/apache_auth_basic') }}"
notify: restart apache2
- name: install python3-passlib
apt:
pkg:
- python3-passlib
- name: Add a default admin user to /etc/apache2/papyrus-htpasswd
community.general.htpasswd:
path: /etc/apache2/papyrus-htpasswd
name: admin
password: 'papyrus'
owner: root
group: www-data
mode: 0640
- name: Add a default coordinator user to /etc/apache2/papyrus-htpasswd
community.general.htpasswd:
path: /etc/apache2/papyrus-htpasswd
name: coordinator
password: 'papyrus'
owner: root
group: www-data
mode: 0640
- name: Add a default student user to /etc/apache2/papyrus-htpasswd
community.general.htpasswd:
path: /etc/apache2/papyrus-htpasswd
name: student
password: 'papyrus'
owner: root
group: www-data
mode: 0640
- name: Add an API user to /etc/apache2/papyrus-htpasswd
community.general.htpasswd:
path: /etc/apache2/papyrus-htpasswd
name: apiuser
password: 'papyrus'
owner: root
group: www-data
mode: 0640
handlers:
- name: restart apache2
systemd:
state: restarted
name: apache2
enabled: yes
- import_playbook: ansible-rails/install_rails_app.yml