include: | |||||
- core.apt | |||||
{% if grains['os']=="Ubuntu" %} | |||||
mod-fcgid: | |||||
pkg.installed: | |||||
- name: libapache2-mod-fcgid | |||||
- order: 180 | |||||
- require: | |||||
- pkg: apache2 | |||||
a2enmod fcgid: | |||||
cmd.run: | |||||
- order: 225 | |||||
- unless: ls /etc/apache2/mods-enabled/fcgid.load | |||||
- require: | |||||
- pkg: mod-fcgid | |||||
- watch_in: | |||||
- cmd: apache2-restart | |||||
{% endif %} |
include: | |||||
- core.apt | |||||
- core.apache2.register_site | |||||
{% if grains['os']=="Ubuntu" %} | |||||
apache2: | |||||
pkg.installed: | |||||
- name: apache2 | |||||
- order: 175 | |||||
service.running: | |||||
- enable: True | |||||
- order: 455 | |||||
a2dissite 000-default: | |||||
cmd.run: | |||||
- order: 225 | |||||
- onlyif: ls /etc/apache2/sites-enabled/000-default | |||||
- watch_in: | |||||
- cmd: apache2-reload | |||||
- require: | |||||
- pkg: apache2 | |||||
apache2-reload: | |||||
cmd.wait: | |||||
- name: service apache2 reload | |||||
- order: 420 | |||||
apache2-restart: | |||||
cmd.wait: | |||||
- name: service apache2 restart | |||||
- order: 425 | |||||
/etc/apache2/sites-available/default: | |||||
file.absent: | |||||
- order: 230 | |||||
- require: | |||||
- pkg: apache2 | |||||
/etc/apache2/sites-available/default-ssl: | |||||
file.absent: | |||||
- order: 230 | |||||
- require: | |||||
- pkg: apache2 | |||||
{% endif %} #END: os = ubuntu |
include: | |||||
- core.apt | |||||
{% if grains['os']=="Ubuntu" %} | |||||
mod-php5: | |||||
pkg.installed: | |||||
- name: libapache2-mod-php5 | |||||
- order: 180 | |||||
- require: | |||||
- pkg: apache2 | |||||
a2enmod php5: | |||||
cmd.run: | |||||
- unless: ls /etc/apache2/mods-enabled/php5.load | |||||
- require: | |||||
- pkg: mod-php5 | |||||
- watch_in: | |||||
- cmd: apache2-restart | |||||
{% if 'apache2-php-ini' in pillar %} | |||||
/etc/php5/apache2/php.ini: | |||||
file.managed: | |||||
- source: {{ pillar['apache2-php-ini'] }} | |||||
- order: 225 | |||||
- watch_in: | |||||
- cmd: apache2-restart | |||||
- require: | |||||
- pkg: apache2 | |||||
- pkg: php5 | |||||
{% endif %} | |||||
{% endif %} |
{% if 'apache2-register-site' in pillar %} #BEGIN: apache2-register-site | |||||
{% for site in pillar['apache2-register-site'] %} | |||||
#BEGIN: Call apache a2ensite | |||||
########################################## | |||||
{% if 'name' in pillar['apache2-register-site'][site] and 'state' in pillar['apache2-register-site'][site] %} | |||||
{% if pillar['apache2-register-site'][site]['state'] == 'enabled' %} | |||||
a2ensite {{ pillar['apache2-register-site'][site]['name'] }}: | |||||
{% else %} | |||||
a2dissite {{ pillar['apache2-register-site'][site]['name'] }}: | |||||
{% endif %} | |||||
cmd.run: | |||||
{% if pillar['apache2-register-site'][site]['state'] == 'enabled' %} | |||||
- unless: ls /etc/apache2/sites-enabled/{{ pillar['apache2-register-site'][site]['name'] }} | |||||
{% else %} | |||||
- onlyif: ls /etc/apache2/sites-enabled/{{ pillar['apache2-register-site'][site]['name'] }} | |||||
{% endif %} | |||||
- order: 230 | |||||
- require: | |||||
- pkg: apache2 | |||||
- file: /etc/apache2/sites-available/{{ pillar['apache2-register-site'][site]['name'] }} | |||||
{% endif %} | |||||
########################################## | |||||
#BEGIN: Manage apache site config | |||||
########################################## | |||||
{% if 'name' in pillar['apache2-register-site'][site] and 'path' in pillar['apache2-register-site'][site] %} | |||||
/etc/apache2/sites-available/{{ pillar['apache2-register-site'][site]['name'] }}: | |||||
file.managed: | |||||
- source: {{ pillar['apache2-register-site'][site]['path'] }} | |||||
- order: 225 | |||||
- user: root | |||||
- group: root | |||||
- mode: 775 | |||||
- watch_in: | |||||
- cmd: a2ensite {{ pillar['apache2-register-site'][site]['name'] }} | |||||
- cmd: apache2-reload | |||||
{% endif %} | |||||
########################################## | |||||
{% endfor %} | |||||
{% endif %} #END: apache2-register-site |
include: | |||||
- core.apt | |||||
{% if grains['os']=="Ubuntu" %} | |||||
a2enmod rewrite: | |||||
cmd.run: | |||||
- unless: ls /etc/apache2/mods-enabled/rewrite.load | |||||
- watch_in: | |||||
- cmd: apache2-restart | |||||
{% endif %} |