Ver código fonte

Add well-known directory to all hosts served by Apache

Thomas Buck 5 anos atrás
pai
commit
cce03e9f94

+ 18
- 2
roles/blog/tasks/blog.yml Ver arquivo

@@ -2,15 +2,31 @@
2 2
   file: state=directory path={{ item }} group=www-data owner={{ main_user_name }}
3 3
   with_items: "{{ virtual_domains | json_query('[*].doc_root') | unique }}"
4 4
 
5
-- name: Create the Apache sites config files
5
+- name: Create directory for well-known configs
6
+  file: state=directory path=/var/www/well-known group=www-data owner=www-data
7
+
8
+- name: Create the Apache well-known config
9
+  template:
10
+    src=etc_apache2_conf-available_well-known.j2
11
+    dest=/etc/apache2/conf-available/well-known.conf
12
+    owner=root
13
+    group=root
14
+  notify: restart apache
15
+
16
+- name: Enable the Apache well-known config
17
+  command: a2enconf well-known.conf creates=/etc/apache2/conf-enabled/well-known.conf.conf
18
+  notify: restart apache
19
+
20
+- name: Create the Apache blog sites config files
6 21
   template:
7 22
     src=etc_apache2_sites-available_blog.j2
8 23
     dest=/etc/apache2/sites-available/{{ item.name }}.conf
9 24
     owner=root
10 25
     group=root
26
+  notify: restart apache
11 27
   with_items: "{{ virtual_domains }}"
12 28
 
13
-- name: Enable Apache sites (creates new sites-enabled symlinks)
29
+- name: Enable Apache blog sites (creates new sites-enabled symlinks)
14 30
   command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
15 31
   notify: restart apache
16 32
   with_items: "{{ virtual_domains | json_query('[*].name') }}"

+ 7
- 0
roles/blog/templates/etc_apache2_conf-available_well-known.j2 Ver arquivo

@@ -0,0 +1,7 @@
1
+Alias /.well-known /var/www/well-known
2
+
3
+<Directory /var/www/well-known>
4
+    Options +Indexes +FollowSymLinks
5
+    AllowOverride none
6
+    Require all granted
7
+</Directory>

Carregando…
Cancelar
Salvar