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

Better Drupal and Drush setup

parent 76f4a0c1
Branches
No related tags found
No related merge requests found
---
# file: roles/drupal/tasks/apache.yml
- name: "Apache configuration file for our site(s)"
template:
src='etc_apache2_sites_available_vhost'
dest='/etc/apache2/sites-available/{{ item.apache_site|default(item.jail.name) }}{{ apache_conf_ext }}'
owner='root'
group='root'
mode='664'
with_items: drupal_settings
when: item.jail is defined or item.apache_site
notify:
- "Apache | Restart Apache"
- name: "Apache enable our new site(s)"
command: a2ensite {{ item.apache_site|default(item.jail.name) }} creates=/etc/apache2/sites-enabled/{{ item.apache_site|default(item.jail.name) }}{{ apache_conf_ext }}
with_items: drupal_settings
when: item.jail is defined or item.apache_site
notify:
- "Apache | Restart Apache"
- name: "Setup AuthType Basic"
htpasswd:
path='/var/www/passwords/{{ item.apache_auth.user }}'
name='{{ item.apache_auth.user }}'
password='{{ item.apache_auth.password }}'
owner='www-data'
group='www-data'
mode='640'
with_items: drupal_settings
when: item.apache_auth is defined
......@@ -76,33 +76,3 @@
with_subelements:
- drupal_settings
- domains
- name: "Drupal | Apache configuration file for our site(s)"
template:
src=etc_apache2_sites_available_vhost
dest=/etc/apache2/sites-available/{{ item.apache_site }}{{ apache_conf_ext }}
owner=root
group=root
mode=0664
with_items: drupal_settings
when: item.apache_site
notify:
- "Apache | Restart Apache"
- name: "Drupal | Apache enable our new site(s)"
command: a2ensite {{ item.apache_site }} creates=/etc/apache2/sites-enabled/{{ item.apache_site }}{{ apache_conf_ext }}
with_items: drupal_settings
when: item.apache_site
notify:
- "Apache | Restart Apache"
- name: "Drupal | Setup AuthType Basic"
htpasswd:
path="/var/www/passwords/{{ item.apache_auth.user }}"
name="{{ item.apache_auth.user }}"
password="{{ item.apache_auth.password }}"
owner=www-data
group=www-data
mode=640
with_items: drupal_settings
when: item.apache_auth is defined
---
# file: roles/drupal/tasks/main.yml
- name: "Drupal | Configure Apache"
include: apache.yml
- name: "Drupal | Install Drupal"
include: install.yml
when: drupal_install_drupal
......
......@@ -3,20 +3,17 @@
ServerName {{ item.domains.0.domain }}
ServerAlias{% for domain in item.domains %} {{ domain.domain }}{% for alias in domain.aliases %} {{ alias }}{% endfor %}{% endfor %}
{% if item.jail is defined %}
{% set prefix = item.jail.name ~ "-" %}
{% set docRoot = jailroot ~ "/" ~ item.jail.name ~ "/var/www" %}
<ifmodule mpm_itk_module>
AssignUserID {{ item.jail.name item.jail.name }}
AssignUserID {{ item.jail.name }} {{ item.jail.name }}
</ifmodule>
DocumentRoot {{ jailroot }}/{{ item.jail.name }}/var/www
<Directory {{ jailroot }}/{{ item.jail.name }}/var/www/>
{% else %}
{% set prefix = '' %}
{% set docRoot = '/var/www/'{{ item.root }} %}
DocumentRoot /var/www/{{ item.root }}
<Directory /var/www/{{ item.root }}/>
{% endif %}
DocumentRoot {{ docRoot }}
<Directory {{ docRoot }}/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
{% if item.apache_auth is defined %}
......@@ -30,7 +27,11 @@
{% endif %}
</Directory>
ErrorLog ${APACHE_LOG_DIR}/{{ prefix }}error.log
{% if item.jail is defined %}
ErrorLog ${APACHE_LOG_DIR}/{{ item.jail.name }}-error.log
{% else %}
ErrorLog ${APACHE_LOG_DIR}/error.log
{% endif %}
LogLevel warn
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment