|
@@ -0,0 +1,71 @@
|
|
1
|
+- name: Install LimeSurvey dependencies
|
|
2
|
+ apt:
|
|
3
|
+ name: "{{ packages }}"
|
|
4
|
+ state: present
|
|
5
|
+ vars:
|
|
6
|
+ packages:
|
|
7
|
+ - php
|
|
8
|
+ - libapache2-mod-php
|
|
9
|
+ tags:
|
|
10
|
+ - dependencies
|
|
11
|
+
|
|
12
|
+- name: Create temporary LimeSurvey directory
|
|
13
|
+ file: state=directory path=/root/limesurvey
|
|
14
|
+
|
|
15
|
+- name: Create temporary LimeSurvey extract directory
|
|
16
|
+ file: state=directory path=/root/limesurvey/limesurvey-{{ limesurvey_version }}
|
|
17
|
+
|
|
18
|
+- name: Download LimeSurvey {{ limesurvey_version }} release
|
|
19
|
+ get_url:
|
|
20
|
+ url="{{ limesurvey_url }}"
|
|
21
|
+ dest=/root/limesurvey/limesurvey-{{ limesurvey_version }}.zip
|
|
22
|
+
|
|
23
|
+- name: Extract LimeSurvey {{ limesurvey_version }} release
|
|
24
|
+ unarchive:
|
|
25
|
+ src: /root/limesurvey/limesurvey-{{ limesurvey_version }}.zip
|
|
26
|
+ dest: /root/limesurvey/limesurvey-{{ limesurvey_version }}
|
|
27
|
+ remote_src: yes
|
|
28
|
+
|
|
29
|
+- name: Copy LimeSurvey to web server directory
|
|
30
|
+ shell: cp -R /root/limesurvey/limesurvey-{{ limesurvey_version }}/limesurvey/. /var/www/limesurvey/
|
|
31
|
+
|
|
32
|
+- name: Ensure proper LimeSurvey permissions
|
|
33
|
+ file:
|
|
34
|
+ path=/var/www/limesurvey
|
|
35
|
+ state=directory
|
|
36
|
+ recurse=yes
|
|
37
|
+ owner=www-data
|
|
38
|
+ group=www-data
|
|
39
|
+
|
|
40
|
+- name: Add LimeSurvey postgres user
|
|
41
|
+ postgresql_user:
|
|
42
|
+ login_host=localhost
|
|
43
|
+ login_user={{ db_admin_username }}
|
|
44
|
+ login_password="{{ db_admin_password }}"
|
|
45
|
+ name={{ limesurvey_db_username }}
|
|
46
|
+ password="{{ limesurvey_db_password }}"
|
|
47
|
+ encrypted=yes
|
|
48
|
+ state=present
|
|
49
|
+
|
|
50
|
+- name: Create LimeSurvey database
|
|
51
|
+ postgresql_db:
|
|
52
|
+ login_host=localhost
|
|
53
|
+ login_user={{ db_admin_username }}
|
|
54
|
+ login_password="{{ db_admin_password }}"
|
|
55
|
+ name={{ limesurvey_db_database }}
|
|
56
|
+ state=present
|
|
57
|
+ owner={{ limesurvey_db_username }}
|
|
58
|
+
|
|
59
|
+- name: Create the Apache LimeSurvey sites config files
|
|
60
|
+ template:
|
|
61
|
+ src=etc_apache2_sites-available_limesurvey.j2
|
|
62
|
+ dest=/etc/apache2/sites-available/limesurvey_{{ item.name }}.conf
|
|
63
|
+ owner=root
|
|
64
|
+ group=root
|
|
65
|
+ with_items: "{{ virtual_domains }}"
|
|
66
|
+ notify: restart apache
|
|
67
|
+
|
|
68
|
+- name: Enable Apache sites (creates new sites-enabled symlinks)
|
|
69
|
+ command: a2ensite limesurvey_{{ item }}.conf creates=/etc/apache2/sites-enabled/limesurvey_{{ item }}.conf
|
|
70
|
+ notify: restart apache
|
|
71
|
+ with_items: "{{ virtual_domains | json_query('[*].name') }}"
|