From 2b2fea746f1b672e6eaed09a656a6b6332ead1b2 Mon Sep 17 00:00:00 2001 From: Alan McNea Date: Mon, 29 Jul 2013 21:29:41 +0000 Subject: [PATCH] Added my stuff --- fcgid.sls | 22 ++++++++++++++++++++++ init.sls | 46 ++++++++++++++++++++++++++++++++++++++++++++++ php5.sls | 33 +++++++++++++++++++++++++++++++++ register_site.sls | 46 ++++++++++++++++++++++++++++++++++++++++++++++ rewrite.sls | 12 ++++++++++++ 5 files changed, 159 insertions(+) create mode 100644 fcgid.sls create mode 100644 init.sls create mode 100644 php5.sls create mode 100644 register_site.sls create mode 100644 rewrite.sls diff --git a/fcgid.sls b/fcgid.sls new file mode 100644 index 0000000..cfe3986 --- /dev/null +++ b/fcgid.sls @@ -0,0 +1,22 @@ +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 %} diff --git a/init.sls b/init.sls new file mode 100644 index 0000000..43dfe7c --- /dev/null +++ b/init.sls @@ -0,0 +1,46 @@ +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 diff --git a/php5.sls b/php5.sls new file mode 100644 index 0000000..a2c9893 --- /dev/null +++ b/php5.sls @@ -0,0 +1,33 @@ +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 %} diff --git a/register_site.sls b/register_site.sls new file mode 100644 index 0000000..428b9d9 --- /dev/null +++ b/register_site.sls @@ -0,0 +1,46 @@ +{% 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 diff --git a/rewrite.sls b/rewrite.sls new file mode 100644 index 0000000..75e7b37 --- /dev/null +++ b/rewrite.sls @@ -0,0 +1,12 @@ +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 %}