Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting default files for CentOS/RedHat and ssl default file #131

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ apache_create_vhosts: true
apache_vhosts_filename: "vhosts.conf"
apache_vhosts_template: "vhosts.conf.j2"

# On Debian/Ubuntu, a default virtualhost is included in Apache's configuration.
# Set this to `true` to remove that default.
# Delete default virtualhost files included in Apache's configuration.
# The set of files varies with OS and Apache version.
# This role by default removes:
# for Apache 2.2: 000-default, welcome.conf, userdir.conf, autoindex.conf
# for Apache 2.4: 000-default.conf, welcome.conf, userdir.conf, autoindex.conf
# Set this to `true` to remove these default files.
apache_remove_default_vhost: false

# Delete default SSL virtualhost files included in Apache's configuration.
# The set of files varies with OS and Apache version.
# This role by default removes:
# for Apache 2.2: ssl.conf
# for Apache 2.4: ssl.conf
# Set this to `true` to remove these default files.
apache_remove_default_vhost_ssl: false

apache_global_vhost_settings: |
DirectoryIndex index.php index.html

Expand Down
12 changes: 11 additions & 1 deletion tasks/configure-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@

- name: Remove default vhost in sites-enabled.
file:
path: "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}"
path: "{{ apache_conf_path }}/sites-enabled/{{ item }}"
state: absent
notify: restart apache
with_items: "{{ apache_default_vhost_filenames }}"
when: apache_remove_default_vhost

- name: Remove default vhost_ssl in sites-enabled.
file:
path: "{{ apache_conf_path }}/{{ item }}"
state: absent
notify: restart apache
with_items: "{{ apache_default_vhost_ssl_filenames }}"
when: apache_remove_default_vhost_ssl

16 changes: 16 additions & 0 deletions tasks/configure-RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@
mode: 0644
notify: restart apache
when: apache_create_vhosts

- name: Remove default vhost configurations
file:
path: "{{ apache_conf_path }}/{{ item }}"
state: absent
notify: restart apache
with_items: "{{ apache_default_vhost_filenames }}"
when: apache_remove_default_vhost

- name: Remove default vhost ssl configurations
file:
path: "{{ apache_conf_path }}/{{ item }}"
state: absent
notify: restart apache
with_items: "{{ apache_default_vhost_ssl_filenames }}"
when: apache_remove_default_vhost_ssl
8 changes: 7 additions & 1 deletion vars/apache-22.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
apache_vhosts_version: "2.2"
apache_default_vhost_filename: 000-default
apache_default_vhost_filenames:
- 000-default
- welcome.conf
- userdir.conf
- autoindex.conf
apache_default_vhost_ssl_filenames:
- ssl.conf
apache_ports_configuration_items:
- {
regexp: "^Listen ",
Expand Down
8 changes: 7 additions & 1 deletion vars/apache-24.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
apache_vhosts_version: "2.4"
apache_default_vhost_filename: 000-default.conf
apache_default_vhost_filenames:
- 000-default.conf
- welcome.conf
- userdir.conf
- autoindex.conf
apache_default_vhost_ssl_filenames:
- ssl.conf
apache_ports_configuration_items:
- {
regexp: "^Listen ",
Expand Down