Przeglądaj źródła

Added rules for dealing with old virtualhost files in

/etc/apache2/sites-available and old (dangling) symlinks in
/etc/apaches/sites-enabled.
Also, remove unnecessary apache2 restart after creating a new
virtualhost but not yet enabling it.
Sven Neuhaus 10 lat temu
rodzic
commit
ab614fd70a

+ 8
- 1
roles/blog/tasks/blog.yml Wyświetl plik

@@ -1,9 +1,16 @@
1 1
 - name: Create directory for blog HTML
2 2
   file: state=directory path=/var/www/{{ domain }} group=www-data owner=www-data
3 3
 
4
+- name: Rename existing Apache blog virtualhost
5
+  command: mv /etc/apache2/sites-available/{{ domain }} /etc/apache2/sites-available/{{ domain }}.conf
6
+  removes: /etc/apache2/sites-available/{{ domain }}
7
+
8
+- name: Remove old sites-enabled/{{ domain }} symlink (new one will be created by a2ensite)
9
+  command: rm /etc/apache2/sites-enabled/{{ domain }}
10
+  removes: /etc/apache2/sites-enabled/{{ domain }}
11
+
4 12
 - name: Configure the Apache HTTP server for the blog
5 13
   template: src=etc_apache2_sites-available_blog.j2 dest=/etc/apache2/sites-available/{{ domain }}.conf group=root owner=root
6
-  notify: restart apache
7 14
 
8 15
 - name: Enable blog site
9 16
   command: a2ensite {{ domain }}.conf creates=/etc/apache2/sites-enabled/{{ domain }}.conf

+ 8
- 1
roles/git/tasks/cgit.yml Wyświetl plik

@@ -32,12 +32,19 @@
32 32
             group=www-data
33 33
             owner=www-data
34 34
 
35
+- name: Rename existing Apache cgit virtualhost
36
+  command: mv /etc/apache2/sites-available/cgit /etc/apache2/sites-available/cgit.conf
37
+  removes: /etc/apache2/sites-available/cgit
38
+
39
+- name: Remove old sites-enabled/cgit symlink (new one will be created by a2ensite)
40
+  command: rm /etc/apache2/sites-enabled/cgit
41
+  removes: /etc/apache2/sites-enabled/cgit
42
+
35 43
 - name: Configure the Apache HTTP server for cgit
36 44
   template: src=etc_apache2_sites-available_cgit.j2
37 45
             dest=/etc/apache2/sites-available/cgit.conf
38 46
             group=root
39 47
             owner=root
40
-  notify: restart apache
41 48
 
42 49
 - name: Enable Apache cgi module
43 50
   command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load

+ 9
- 1
roles/newebe/tasks/main.yml Wyświetl plik

@@ -71,12 +71,20 @@
71 71
 # When Ansible 1.6 will be available  
72 72
 # apache2_module: state=present name=proxy_http
73 73
 #
74
+
75
+- name: Rename existing Apache newebe virtualhost
76
+  command: mv /etc/apache2/sites-available/newebe /etc/apache2/sites-available/newebe.conf
77
+  removes: /etc/apache2/sites-available/newebe
78
+
79
+- name: Remove old sites-enabled/newebe symlink (new one will be created by a2ensite)
80
+  command: rm /etc/apache2/sites-enabled/newebe
81
+  removes: /etc/apache2/sites-enabled/newebe
82
+
74 83
 - name: Configure the Apache HTTP server for Newebe
75 84
   template: src=etc_apache2_sites-available_newebe.j2
76 85
             dest=/etc/apache2/sites-available/newebe.conf
77 86
             group=root
78 87
             owner=root
79
-  notify: restart apache
80 88
 
81 89
 - name: Enable the site
82 90
   command: a2ensite newebe.conf

+ 8
- 1
roles/news/tasks/selfoss.yml Wyświetl plik

@@ -26,9 +26,16 @@
26 26
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
27 27
   notify: restart apache
28 28
 
29
+- name: Rename existing Apache blog virtualhost
30
+  command: mv /etc/apache2/sites-available/selfoss /etc/apache2/sites-available/selfoss.conf
31
+  removes: /etc/apache2/sites-available/selfoss
32
+
33
+- name: Remove old sites-enabled/selfoss symlink (new one will be created by a2ensite)
34
+  command: rm /etc/apache2/sites-enabled/selfoss
35
+  removes: /etc/apache2/sites-enabled/selfoss
36
+
29 37
 - name: Configure the Apache HTTP server for selfoss
30 38
   template: src=etc_apache2_sites-available_selfoss.j2 dest=/etc/apache2/sites-available/selfoss.conf group=root owner=root
31
-  notify: restart apache
32 39
 
33 40
 - name: Enable the selfoss site
34 41
   command: a2ensite selfoss.conf creates=/etc/apache2/sites-enabled/selfoss.conf

+ 8
- 1
roles/owncloud/tasks/owncloud.yml Wyświetl plik

@@ -44,9 +44,16 @@
44 44
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
45 45
   notify: restart apache
46 46
 
47
+- name: Rename existing Apache owncloud virtualhost
48
+  command: mv /etc/apache2/sites-available/owncloud /etc/apache2/sites-available/owncloud.conf
49
+  removes: /etc/apache2/sites-available/owncloud
50
+
51
+- name: Remove old sites-enabled/owncloud symlink (new one will be created by a2ensite)
52
+  command: rm /etc/apache2/sites-enabled/owncloud
53
+  removes: /etc/apache2/sites-enabled/owncloud
54
+
47 55
 - name: Configure the Apache HTTP server for ownCloud
48 56
   template: src=etc_apache2_sites-available_owncloud.j2 dest=/etc/apache2/sites-available/owncloud.conf group=root owner=root
49
-  notify: restart apache
50 57
 
51 58
 - name: Enable the owncloud site
52 59
   command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf

+ 8
- 1
roles/readlater/tasks/wallabag.yml Wyświetl plik

@@ -52,12 +52,19 @@
52 52
             owner=www-data
53 53
             group=www-data
54 54
 
55
+- name: Rename existing Apache wallabag virtualhost
56
+  command: mv /etc/apache2/sites-available/wallabag /etc/apache2/sites-available/wallabag.conf
57
+  removes: /etc/apache2/sites-available/wallabag
58
+
59
+- name: Remove old sites-enabled/wallabag symlink (new one will be created by a2ensite)
60
+  command: rm /etc/apache2/sites-enabled/wallabag
61
+  removes: /etc/apache2/sites-enabled/wallabag
62
+
55 63
 - name: Configure the Apache HTTP server for wallabag
56 64
   template: src=etc_apache2_sites-available_wallabag.j2
57 65
             dest=/etc/apache2/sites-available/wallabag.conf
58 66
             owner=root
59 67
             group=root
60
-  notify: restart apache
61 68
 
62 69
 - name: Enable the wallabag site
63 70
   command: a2ensite wallabag.conf

+ 8
- 0
roles/webmail/tasks/roundcube.yml Wyświetl plik

@@ -32,6 +32,14 @@
32 32
     - carddav
33 33
     - twofactor_gauthenticator
34 34
 
35
+- name: Rename existing Apache roundcube virtualhost
36
+  command: mv /etc/apache2/sites-available/roundcube /etc/apache2/sites-available/roundcube.conf
37
+  removes: /etc/apache2/sites-available/roundcube
38
+
39
+- name: Remove old sites-enabled/roundcube symlink (new one will be created by a2ensite)
40
+  command: rm /etc/apache2/sites-enabled/roundcube
41
+  removes: /etc/apache2/sites-enabled/roundcube
42
+
35 43
 - name: Configure the Apache HTTP server for roundcube
36 44
   template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube.conf group=root owner=root force=yes
37 45
 

Ładowanie…
Anuluj
Zapisz