Browse Source

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 years ago
parent
commit
ab614fd70a

+ 8
- 1
roles/blog/tasks/blog.yml View File

1
 - name: Create directory for blog HTML
1
 - name: Create directory for blog HTML
2
   file: state=directory path=/var/www/{{ domain }} group=www-data owner=www-data
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
 - name: Configure the Apache HTTP server for the blog
12
 - name: Configure the Apache HTTP server for the blog
5
   template: src=etc_apache2_sites-available_blog.j2 dest=/etc/apache2/sites-available/{{ domain }}.conf group=root owner=root
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
 - name: Enable blog site
15
 - name: Enable blog site
9
   command: a2ensite {{ domain }}.conf creates=/etc/apache2/sites-enabled/{{ domain }}.conf
16
   command: a2ensite {{ domain }}.conf creates=/etc/apache2/sites-enabled/{{ domain }}.conf

+ 8
- 1
roles/git/tasks/cgit.yml View File

32
             group=www-data
32
             group=www-data
33
             owner=www-data
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
 - name: Configure the Apache HTTP server for cgit
43
 - name: Configure the Apache HTTP server for cgit
36
   template: src=etc_apache2_sites-available_cgit.j2
44
   template: src=etc_apache2_sites-available_cgit.j2
37
             dest=/etc/apache2/sites-available/cgit.conf
45
             dest=/etc/apache2/sites-available/cgit.conf
38
             group=root
46
             group=root
39
             owner=root
47
             owner=root
40
-  notify: restart apache
41
 
48
 
42
 - name: Enable Apache cgi module
49
 - name: Enable Apache cgi module
43
   command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load
50
   command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load

+ 9
- 1
roles/newebe/tasks/main.yml View File

71
 # When Ansible 1.6 will be available  
71
 # When Ansible 1.6 will be available  
72
 # apache2_module: state=present name=proxy_http
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
 - name: Configure the Apache HTTP server for Newebe
83
 - name: Configure the Apache HTTP server for Newebe
75
   template: src=etc_apache2_sites-available_newebe.j2
84
   template: src=etc_apache2_sites-available_newebe.j2
76
             dest=/etc/apache2/sites-available/newebe.conf
85
             dest=/etc/apache2/sites-available/newebe.conf
77
             group=root
86
             group=root
78
             owner=root
87
             owner=root
79
-  notify: restart apache
80
 
88
 
81
 - name: Enable the site
89
 - name: Enable the site
82
   command: a2ensite newebe.conf
90
   command: a2ensite newebe.conf

+ 8
- 1
roles/news/tasks/selfoss.yml View File

26
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
26
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
27
   notify: restart apache
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
 - name: Configure the Apache HTTP server for selfoss
37
 - name: Configure the Apache HTTP server for selfoss
30
   template: src=etc_apache2_sites-available_selfoss.j2 dest=/etc/apache2/sites-available/selfoss.conf group=root owner=root
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
 - name: Enable the selfoss site
40
 - name: Enable the selfoss site
34
   command: a2ensite selfoss.conf creates=/etc/apache2/sites-enabled/selfoss.conf
41
   command: a2ensite selfoss.conf creates=/etc/apache2/sites-enabled/selfoss.conf

+ 8
- 1
roles/owncloud/tasks/owncloud.yml View File

44
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
44
   command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
45
   notify: restart apache
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
 - name: Configure the Apache HTTP server for ownCloud
55
 - name: Configure the Apache HTTP server for ownCloud
48
   template: src=etc_apache2_sites-available_owncloud.j2 dest=/etc/apache2/sites-available/owncloud.conf group=root owner=root
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
 - name: Enable the owncloud site
58
 - name: Enable the owncloud site
52
   command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf
59
   command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf

+ 8
- 1
roles/readlater/tasks/wallabag.yml View File

52
             owner=www-data
52
             owner=www-data
53
             group=www-data
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
 - name: Configure the Apache HTTP server for wallabag
63
 - name: Configure the Apache HTTP server for wallabag
56
   template: src=etc_apache2_sites-available_wallabag.j2
64
   template: src=etc_apache2_sites-available_wallabag.j2
57
             dest=/etc/apache2/sites-available/wallabag.conf
65
             dest=/etc/apache2/sites-available/wallabag.conf
58
             owner=root
66
             owner=root
59
             group=root
67
             group=root
60
-  notify: restart apache
61
 
68
 
62
 - name: Enable the wallabag site
69
 - name: Enable the wallabag site
63
   command: a2ensite wallabag.conf
70
   command: a2ensite wallabag.conf

+ 8
- 0
roles/webmail/tasks/roundcube.yml View File

32
     - carddav
32
     - carddav
33
     - twofactor_gauthenticator
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
 - name: Configure the Apache HTTP server for roundcube
43
 - name: Configure the Apache HTTP server for roundcube
36
   template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube.conf group=root owner=root force=yes
44
   template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube.conf group=root owner=root force=yes
37
 
45
 

Loading…
Cancel
Save