Issue #12: Use sites-available and sites-enabled Debian convention.

This commit is contained in:
Jeff Geerling 2014-10-05 18:58:35 -05:00
parent 3a277cbff6
commit d191d3a7fd
6 changed files with 55 additions and 24 deletions

View file

@ -16,6 +16,9 @@ galaxy_info:
- all
- name: Ubuntu
versions:
- all
- precise
- raring
- saucy
- trusty
categories:
- web

View file

@ -1,31 +1,37 @@
---
- name: Ensure Apache is installed (Debian).
- name: Ensure Apache is installed.
apt: >
name={{ item }}
state=installed
with_items: apache_packages
- name: Configure Apache (Debian).
- name: Configure Apache.
lineinfile: >
dest="{{ apache_server_root }}/ports.conf"
regexp="{{ item.regexp }}"
line="{{ item.line }}"
state=present
with_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}
with_items: apache_ports_configuration_items
notify: restart apache
- name: Enable Apache mods (Debian).
- name: Enable Apache mods.
file: >
src={{ apache_server_root }}/mods-available/{{ item }}
dest={{ apache_server_root }}/mods-enabled/{{ item }}
state=link
with_items: apache_mods_enabled
notify: restart apache
- name: Add apache vhosts configuration.
template: >
src=vhosts-{{ apache_vhosts_version }}.conf.j2
dest={{ apache_conf_path }}/sites-available/vhosts.conf
owner=root group=root mode=644
notify: restart apache
when: apache_create_vhosts
- name: Add vhost symlink in sites-enabled.
file:
src: "{{ apache_conf_path }}/sites-available/vhosts.conf"
dest: "{{ apache_conf_path }}/sites-enabled/vhosts.conf"
state: link

View file

@ -12,13 +12,5 @@
regexp="{{ item.regexp }}"
line="{{ item.line }}"
state=present
with_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}
with_items: apache_ports_configuration_items
notify: restart apache

View file

@ -1,11 +1,22 @@
---
apache_daemon: apache2
apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled
apache_conf_path: /etc/apache2
apache_vhosts_version: "2.2"
__apache_packages:
- apache2
- apache2-mpm-prefork
- apache2-utils
- apache2.2-bin
- apache2.2-common
apache_ports_configuration_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}

View file

@ -1,10 +1,17 @@
---
apache_daemon: apache2
apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled
apache_conf_path: /etc/apache2
apache_vhosts_version: "2.4"
__apache_packages:
- apache2
- apache2-mpm-prefork
- apache2-utils
- apache2-bin
apache_ports_configuration_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}

View file

@ -2,9 +2,21 @@
apache_daemon: httpd
apache_server_root: /etc/httpd
apache_conf_path: /etc/httpd/conf.d
apache_vhosts_version: "2.2"
__apache_packages:
- httpd
- httpd-devel
- mod_ssl
- openssh
apache_ports_configuration_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}