summaryrefslogtreecommitdiff
path: root/roles/phabricator/tasks/main.yml
blob: 7ff9f2bf86e5ecab0e030cb754ef00d24654e431 (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
---
#need this because ansible's debconf will always detect password vtypes
# as having changed
- name: Get debconf setting for mysql-server root password
  command: debconf-communicate
  args:
    stdin: GET mysql-server/root_password
  register: debconf_output
  changed_when: False
  ignore_errors: yes

- name: Set debconf for mysql root password
  debconf:
    name: mysql-server
    question: "{{item}}"
    value: "{{phabricator_mysql_root_password}}"
    vtype: password
  with_items:
    - mysql-server/root_password
    - mysql-server/root_password_again
  when: debconf_output.stdout is undefined or not debconf_output.stdout| match("\d+\s+%s" % phabricator_mysql_root_password )

# xenial only support 7.0, phab wants at least 7.1
- name: Add PHP 7.2 PPA
  apt_repository:
    repo: ppa:ondrej/php
    state: present
    update_cache: yes

- name: Install packages
  apt: name={{item}}
  with_items:
    - git
    - apache2
    - libapache2-mod-php7.2
    - php7.2-common
    - php7.2
    - php-pear # pulls in pecl tool
    - php7.2-curl
    - php7.2-mysql
    - php7.2-gd
    - php7.2-ldap
    - php-apcu
    - php7.2-mbstring
    - mysql-server
    - mysql-common
    - mysql-client
    - python-mysqldb # required by ansible mysql modules
    - python-pygments

- name: Enable apache modules
  apache2_module:
    name: "{{item}}"
    state: present
  with_items:
    - rewrite
    - ssl
  notify: reload-apache

- name: git clone phabricator repo
  git:
    repo: https://github.com/phacility/phabricator.git
    dest: "{{phabricator_install_dir}}"
  notify:
    - configure-phabricator

- name: git clone libphutil repo
  git:
    repo: https://github.com/phacility/libphutil.git
    dest: "{{phabricator_libphutil_install_dir}}"

- name: git clone arcanist repo
  git:
    repo: https://github.com/phacility/arcanist.git
    dest: "{{phabricator_arcanist_install_dir}}"

- name: Create mysql `phabricator` user
  mysql_user:
    name: "{{phabricator_mysql_user}}"
    password: "{{phabricator_mysql_password}}"
    login_user: root
    login_password: "{{phabricator_mysql_root_password}}"
    state: present
    priv: '*.*:ALL'

- name: Create phd systemctl service file
  template:
    src: phd.service
    dest: /lib/systemd/system/phd.service
  notify: systemctl-enable-phd


- name: Install mysqld.conf
  template:
    src: mysqld.cnf
    dest: /etc/mysql/mysql.conf.d/mysqld.cnf
  notify: restart-mysql

- name: Install phabricator-settings.ini
  template:
    src: phabricator-settings.ini
    dest: /etc/php/7.2/mods-available/phabricator-settings.ini
  notify: reload-apache

- name: Manually enable phabricator-settings.ini
  file:
    src: /etc/php/7.2/mods-available/phabricator-settings.ini
    dest: /etc/php/7.2/apache2/conf.d/90-phabricator-settings.ini
    state: link
    force: yes

- name: Fix opcache default
  template:
    src: opcache.ini
    dest: /etc/php/7.2/mods-available/opcache.ini
  notify: reload-apache

- name: Create uploads dir
  file:
    path: "{{phabricator_install_dir}}/uploads"
    owner: www-data
    group: www-data
    state: directory

- name: Create repos dir
  file:
    path: "{{phabricator_install_dir}}/repositories"
    state: directory