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 - all
- name: Ubuntu - name: Ubuntu
versions: versions:
- all - precise
- raring
- saucy
- trusty
categories: categories:
- web - web

View file

@ -1,31 +1,37 @@
--- ---
- name: Ensure Apache is installed (Debian). - name: Ensure Apache is installed.
apt: > apt: >
name={{ item }} name={{ item }}
state=installed state=installed
with_items: apache_packages with_items: apache_packages
- name: Configure Apache (Debian). - name: Configure Apache.
lineinfile: > lineinfile: >
dest="{{ apache_server_root }}/ports.conf" dest="{{ apache_server_root }}/ports.conf"
regexp="{{ item.regexp }}" regexp="{{ item.regexp }}"
line="{{ item.line }}" line="{{ item.line }}"
state=present state=present
with_items: with_items: apache_ports_configuration_items
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}
notify: restart apache notify: restart apache
- name: Enable Apache mods (Debian). - name: Enable Apache mods.
file: > file: >
src={{ apache_server_root }}/mods-available/{{ item }} src={{ apache_server_root }}/mods-available/{{ item }}
dest={{ apache_server_root }}/mods-enabled/{{ item }} dest={{ apache_server_root }}/mods-enabled/{{ item }}
state=link state=link
with_items: apache_mods_enabled with_items: apache_mods_enabled
notify: restart apache 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 }}" regexp="{{ item.regexp }}"
line="{{ item.line }}" line="{{ item.line }}"
state=present state=present
with_items: with_items: apache_ports_configuration_items
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}
- {
regexp: "^NameVirtualHost ",
line: "NameVirtualHost *:{{ apache_listen_port }}"
}
notify: restart apache notify: restart apache

View file

@ -1,11 +1,22 @@
--- ---
apache_daemon: apache2 apache_daemon: apache2
apache_server_root: /etc/apache2 apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled apache_conf_path: /etc/apache2
apache_vhosts_version: "2.2" apache_vhosts_version: "2.2"
__apache_packages: __apache_packages:
- apache2 - apache2
- apache2-mpm-prefork - apache2-mpm-prefork
- apache2-utils - apache2-utils
- apache2.2-bin - apache2.2-bin
- apache2.2-common - 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_daemon: apache2
apache_server_root: /etc/apache2 apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled apache_conf_path: /etc/apache2
apache_vhosts_version: "2.4" apache_vhosts_version: "2.4"
__apache_packages: __apache_packages:
- apache2 - apache2
- apache2-mpm-prefork - apache2-mpm-prefork
- apache2-utils - apache2-utils
- apache2-bin - apache2-bin
apache_ports_configuration_items:
- {
regexp: "^Listen ",
line: "Listen {{ apache_listen_port }}"
}

View file

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