Thomas Buck пре 3 година
родитељ
комит
8335d7ebc6

+ 13
- 0
roles/limesurvey/defaults/main.yml Прегледај датотеку

@@ -0,0 +1,13 @@
1
+limesurvey_subdomain: "survey"
2
+limesurvey_domain: "{{ limesurvey_subdomain }}.{{ domain }}"
3
+
4
+limesurvey_version: "5.1.17+211025"
5
+limesurvey_url: "https://download.limesurvey.org/latest-stable-release/limesurvey{{ limesurvey_version }}.zip"
6
+
7
+limesurvey_db_username: limesurveyuser
8
+limesurvey_db_password: "{{ lookup('password', secret + '/' + 'limesurvey_db_password length=32') }}"
9
+limesurvey_db_database: limesurvey
10
+
11
+# must match values in roles/common
12
+db_admin_username: 'postgres'
13
+db_admin_password: "{{ lookup('password', secret + '/' + 'db_admin_password length=32') }}"

+ 9
- 0
roles/limesurvey/handlers/main.yml Прегледај датотеку

@@ -0,0 +1,9 @@
1
+- name: restart jitsi
2
+  command: systemctl restart {{ item }}
3
+  with_items:
4
+    - prosody
5
+    - jicofo
6
+    - jitsi-videobridge2
7
+
8
+- name: restart apache
9
+  service: name=apache2 state=restarted

+ 71
- 0
roles/limesurvey/tasks/limesurvey.yml Прегледај датотеку

@@ -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') }}"

+ 2
- 0
roles/limesurvey/tasks/main.yml Прегледај датотеку

@@ -0,0 +1,2 @@
1
+---
2
+- include: limesurvey.yml tags=limesurvey

+ 16
- 0
roles/limesurvey/templates/etc_apache2_sites-available_limesurvey.j2 Прегледај датотеку

@@ -0,0 +1,16 @@
1
+<VirtualHost *:80>
2
+    ServerName {{ limesurvey_subdomain }}.{{ item.name }}
3
+
4
+    Redirect temp / https://{{ limesurvey_subdomain }}.{{ item.name }}/
5
+</VirtualHost>
6
+
7
+<VirtualHost *:443>
8
+    ServerName {{ limesurvey_subdomain }}.{{ item.name }}
9
+
10
+    SSLEngine               On
11
+    DocumentRoot            /var/www/limesurvey
12
+    Options                 -Indexes
13
+    LogLevel                warn
14
+    ErrorLog                /var/log/apache2/gitea.info-error_log
15
+    CustomLog               /var/log/apache2/gitea.info-access_log common
16
+</VirtualHost>

+ 1
- 0
roles/sslletsencrypt/defaults/main.yml Прегледај датотеку

@@ -35,6 +35,7 @@ subdomains:
35 35
   - "kanboard"
36 36
   - "chat"
37 37
   - "users"
38
+  - "survey"
38 39
 
39 40
 # ntp
40 41
 ntp_servers:

Loading…
Откажи
Сачувај