blob: f76a87cd157263c93fac3892214b4b3d5f9093d5 (
plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
---
- name: start httpd (provided in the apache role)
service: name=httpd state=started
- name: ensure packages required for phabricator are installed (yum)
yum: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
with_items:
- MySQL-python
- git
- httpd
- mod_ssl
- php
- php-cli
- php-mysql
- php-process
- php-devel
- php-gd
- php-mbstring
- php-opcache
- python-pygments
- libphutil
- arcanist
- phabricator
when: ansible_distribution_major_version|int < 22
- name: ensure packages required for phabricator are installed (dnf)
dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
with_items:
- MySQL-python
- git
- httpd
- mod_ssl
- php
- php-cli
- php-process
- php-devel
- php-gd
- php-mbstring
- php-opcache
- python-pygments
- libphutil
- arcanist
- phabricator
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
- name: create mariadb user for phabricator
mysql_user:
name: "{{ mariadb_user }}"
host: 'localhost'
password: "{{ mariadb_password }}"
priv: "*.*:ALL"
state: present
login_user: root
login_password: "{{ mariadb_root_password }}"
login_host: "127.0.0.1"
delegate_to: "{{ inventory_hostname }}"
- name: ensure backup directory exists
file: path={{ backup_dir }} state=directory owner=root group=root mode=1755
- name: generate phabricator mysql backup cronjob
template: src=phabricator-mariadb-dump.cron.j2 dest=/etc/cron.d/phabricator-mariadb-dump.cron owner=root group=root mode=0644
- name: create phabricator daemon user
user: name={{ phabricator_daemon_user }}
- name: add apache user to daemon user group
user: name=apache groups={{ phabricator_daemon_user }}
- name: create vcs user
user: name={{ phabricator_vcs_user }} password={{ phabricator_vcs_user_password }} groups={{ phabricator_daemon_user }}
when: enable_phabricator_git
- name: add vcs user to sudoers to write as daemon user with restrictions for git
lineinfile: "dest=/etc/sudoers state=present line='{{ phabricator_vcs_user }} ALL=({{ phabricator_daemon_user }}) SETENV: NOPASSWD: /usr/libexec/git-core/git-upload-pack, /usr/libexec/git-core/git-receive-pack'"
- name: remove tty requirement for sudo by git user
lineinfile: "dest=/etc/sudoers state=present line='Defaults:{{phabricator_vcs_user }} !requiretty'"
- name: add apache user to sudoers to write as daemon user with restrictions for git
lineinfile: "dest=/etc/sudoers state=present line='apache ALL=({{ phabricator_daemon_user }}) SETENV: NOPASSWD: /usr/libexec/git-core/git-http-backend'"
- name: remove tty requirement for sudo by git user
lineinfile: "dest=/etc/sudoers state=present line='Defaults:apache !requiretty'"
- name: update php.ini
copy: src=php.ini dest=/etc/php.d/php.ini owner=root group=root mode=0644
notify:
- reload httpd
- name: update php-opcache config
copy:
src: "10-opcache.ini"
dest: /etc/php.d/10-opcache.ini
owner: root
group: root
mode: 0644
- name: update php-curl config
copy:
src: "20-curl.ini"
dest: /etc/php.d/20-curl.ini
owner: root
group: root
mode: 0644
- name: clone phabricator-extension-ipsilonoauth
git:
repo: 'https://pagure.io/phabricator-extension-ipsilonoauth.git'
dest: /var/www/phabricator-extension-ipsilonoauth
version: c70333b0d2d4d348b429e82e39d634071accf939
- name: create git repo root for phabricator
file: path={{ phabricator_repodir }} state=directory owner={{ phabricator_daemon_user }} group={{ phabricator_daemon_user }} mode=1755
when: enable_phabricator_git
- name: create file directory for phabricator
file: path={{ phabricator_filedir }} state=directory owner=apache group=apache mode=1755
- name: create log directory for phabricator
file: path=/var/log/phabricator state=directory owner={{ phabricator_daemon_user }} group={{ phabricator_daemon_user }} mode=1775
# disabling phabricator env
#- name: generate phabricator environment
# template: src=ENVIRONMENT.j2 dest={{ phabroot }}/phabricator/conf/local/ENVIRONMENT owner=apache group=apache mode=0644
- name: copy phabricator configuration settings
template: src=local.json.j2 dest={{ phabroot }}/phabricator/conf/local/local.json owner=apache group=apache mode=0644
notify:
- restart phd
- name: copy phabricator preamble
copy: src=phabricator-preamble.php dest={{ phabroot }}/phabricator/support/preamble.php owner=apache group=apache mode=0644
- name: copy phabricator custom login plugin
template: src=CustomLoginHandler.php.j2 dest={{ phabroot }}/phabricator/src/extensions/CustomLoginHandler.php owner=apache group=apache mode=0644
notify:
- restart phd
# this isn't well supported upstream right now, disabling
#- name: generate chatbot config
# template: src=chatbot-config.json.j2 dest={{ phabroot }}/phabricator/resources/chatbot/config.json owner=apache group=apache mode=0644
# long story short, I need to let this fail for now until something is fixed, will re-enable. tflink - 2016-12-15
#- name: upgrade phabricator storage
# command: chdir={{ phabroot }}/phabricator bin/storage upgrade --force
- name: generate phabricator git hook
template: src=phabricator-ssh-hook.sh.j2 dest=/etc/phabricator-ssh-hook.sh owner=root group=root mode=0755
when: enable_phabricator_git
- name: generate phabricator ssh config for vcs
template: src=phabricator-sshd.conf.j2 dest=/etc/ssh/phabricator-sshd.conf owner=root group=root mode=0600
when: enable_phabricator_git
- name: generate phabricator ssh service file
template: src=phabricator-sshd.service.j2 dest=/lib/systemd/system/phabricator-sshd.service owner=root group=root mode=0644
when: enable_phabricator_git
- name: start and enable phabricator sshd service
service: name=phabricator-sshd enabled=yes state=started
when: enable_phabricator_git
- name: generate phabricator phd service file
template: src=phd.service.j2 dest=/lib/systemd/system/phd.service owner=root group=root mode=0644
- name: create directory for phd pids
file: path=/var/run/phabricator state=directory owner={{ phabricator_daemon_user }} group={{ phabricator_daemon_user }} mode=1755
- name: start and enable phabricator phd service
service: name=phd enabled=yes state=started
- name: copy phabricator httpd config
template: src=phabricator.conf.j2 dest=/etc/httpd/conf.d/phabricator.conf owner=root group=root mode=0644
tags:
- httpd
notify:
- reload httpd
|