Skip to content
Snippets Groups Projects
Commit f6483545 authored by jurgenhaas's avatar jurgenhaas
Browse files

#10 Fix default configuration for Apache

parent ba0bf644
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,11 @@ ...@@ -68,6 +68,11 @@
tags: tags:
- ApacheConfig - ApacheConfig
- name: Verify if this is the initial installation
stat:
path: /etc/apache2/{{ apache_conf_dir }}/global-redirect.conf
register: apache_initial_install
- name: Configure Security, Global Redirect, Global Deny, Logging - name: Configure Security, Global Redirect, Global Deny, Logging
template: template:
src: etc-apache2-conf-available-{{item }} src: etc-apache2-conf-available-{{item }}
...@@ -134,7 +139,7 @@ ...@@ -134,7 +139,7 @@
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
when: apache_server_default == "yes" when: apache_server_default and not apache_initial_install.stat.exists
notify: notify:
- Restart Apache - Restart Apache
- Checkout htdocs for default - Checkout htdocs for default
...@@ -146,7 +151,7 @@ ...@@ -146,7 +151,7 @@
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
when: apache_server_default_ssl == "yes" when: apache_server_default_ssl and not apache_initial_install.stat.exists
notify: notify:
- Restart Apache - Restart Apache
- Checkout htdocs for default - Checkout htdocs for default
...@@ -164,32 +169,28 @@ ...@@ -164,32 +169,28 @@
- Checkout htdocs for our site(s) - Checkout htdocs for our site(s)
- name: Disable the default site - name: Disable the default site
command: a2dissite {{ item }} command: a2dissite {{ apache_conf_default_prefix }}default
with_items: args:
- default removes: /etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
- '{{ apache_conf_default_prefix }}default' when: not apache_server_default
ignore_errors: yes
when: apache_server_default == "no"
- name: Disable the default ssl site - name: Disable the default ssl site
command: a2dissite {{ item }} command: a2dissite default-ssl
with_items: args:
- default-ssl removes: /etc/apache2/sites-enabled/default-ssl{{ apache_conf_ext }}
- '{{ apache_conf_default_prefix }}default-ssl' when: not apache_server_default_ssl
ignore_errors: yes
when: apache_server_default_ssl == "no"
- name: Enable the default site - name: Enable the default site
command: a2ensite {{ apache_conf_default_prefix }}default command: a2ensite {{ apache_conf_default_prefix }}default
args: args:
creates: /etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }} creates: /etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
when: apache_server_default == "yes" when: apache_server_default
- name: Enable the default ssl site - name: Enable the default ssl site
command: a2ensite {{ apache_conf_default_prefix }}default-ssl command: a2ensite default-ssl
args: args:
creates: /etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default-ssl{{ apache_conf_ext }} creates: /etc/apache2/sites-enabled/default-ssl{{ apache_conf_ext }}
when: apache_server_default_ssl == "yes" when: apache_server_default_ssl
- name: Enable our new site(s) - name: Enable our new site(s)
command: a2ensite {{ item.vhost }} command: a2ensite {{ item.vhost }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment