source: darkpeak-services/roles/sabredav/tasks/main.yml @ 0c882bec

ansiblekeycloakmatrixpleroma
Last change on this file since 0c882bec was 0c882bec, checked in by Caolan McMahon <caolan.mcmahon@…>, 19 months ago

Switch sabredav to mysql so we can copy over existing data

  • Property mode set to 100644
File size: 2.1 KB
Line 
1- name: Create group
2  group:
3    name: "{{ service_name }}"
4    system: yes
5
6- name: Create user
7  user:
8    name: "{{ service_name }}"
9    group: "{{ service_name }}"
10    shell: /usr/sbin/nologin
11    home: "{{ web_root }}"
12    system: yes
13    createhome: no
14
15- name: Add mysql user
16  include: ../../community/geerlingguy.mysql/tasks/users.yml
17
18- name: Add mysql database
19  include: ../../community/geerlingguy.mysql/tasks/databases.yml
20
21- name: Enable LDAP modules in apache
22  apache2_module:
23    name: "{{ item }}"
24    state: present
25    force: yes
26  with_items:
27    - auth_basic
28    - ldap
29    - authnz_ldap
30
31- name: "Do no verify LDAP certificate (we're using self-signed at the moment)"
32  lineinfile:
33    dest: /etc/apache2/apache2.conf
34    line: "LDAPVerifyServerCert Off"
35  notify:
36    - reload apache2
37
38- name: Configure apache for sabredav
39  include: ../../apache2/tasks/configure-apache-site.yml
40
41- name: Install sabredav dependencies
42  apt:
43    name: "{{ item }}"
44  with_items:
45    - php7.0
46    - php-dom
47    - php-mbstring
48    - php-mysql
49    - php-ldap
50
51- name: Copy Composer install script
52  copy:
53    src: install-composer.sh
54    dest: "{{ web_root }}/install-composer.sh"
55    owner: root
56    group: root
57    mode: 0755
58
59- name: Run Composer install script
60  shell: "bash {{ web_root }}/install-composer.sh"
61  args:
62    chdir: "{{ web_root }}"
63    creates: "{{ web_root }}/composer.phar"
64
65- name: Install sabre/dav using Composer
66  command: "php composer.phar require sabre/dav ~{{ sabredav_version }}"
67  args:
68    chdir: "{{ web_root }}"
69
70- name: Add our server.php and LDAPBackend.php to web root
71  template:
72    src: "{{ item }}"
73    dest: "{{ web_root }}/{{ item }}"
74    owner: www-data
75    group: www-data
76    mode: 0440
77  with_items:
78    - "server.php"
79    - "LDAPBackend.php"
80
81- name: Initialise database
82  shell: "cat {{ web_root }}/vendor/sabre/dav/examples/sql/mysql.* | \
83              mysql -u {{ mysql_users[0].name }} \
84                    -p\"{{ mysql_users[0].password }}\" \
85                    {{ mysql_databases[0].name }}"
86  when:
87    "first_run | default(false)"
Note: See TracBrowser for help on using the repository browser.