Author: gjm
Date: Mon May 25 16:24:27 2015
New Revision: 1681607
URL: http://svn.apache.org/r1681607
Log:
adding a vagrant + salt dev setup
Added:
bloodhound/trunk/Vagrantfile
bloodhound/trunk/salt/
bloodhound/trunk/salt/minion
bloodhound/trunk/salt/roots/
bloodhound/trunk/salt/roots/pillar/
bloodhound/trunk/salt/roots/pillar/settings.sls
bloodhound/trunk/salt/roots/pillar/top.sls
bloodhound/trunk/salt/roots/salt/
bloodhound/trunk/salt/roots/salt/bloodhound/
bloodhound/trunk/salt/roots/salt/bloodhound/init.sls
bloodhound/trunk/salt/roots/salt/bloodhound/requirements.txt
bloodhound/trunk/salt/roots/salt/postgresql/
bloodhound/trunk/salt/roots/salt/postgresql/init.sls
bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_8.4.conf
bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_9.1.conf
bloodhound/trunk/salt/roots/salt/requirements/
bloodhound/trunk/salt/roots/salt/requirements/init.sls
bloodhound/trunk/salt/roots/salt/top.sls
bloodhound/trunk/salt/roots/salt/webserver/
bloodhound/trunk/salt/roots/salt/webserver/bloodhound.site
bloodhound/trunk/salt/roots/salt/webserver/init.sls
Added: bloodhound/trunk/Vagrantfile
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/Vagrantfile?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/Vagrantfile (added)
+++ bloodhound/trunk/Vagrantfile Mon May 25 16:24:27 2015
@@ -0,0 +1,46 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Vagrant configuration version 2
+# Please don't change it unless you know what you're doing.
+Vagrant.configure(2) do |config|
+ config.vm.box = "precise64"
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+
+ # Forwarded port mappings:
+ # For apache served bloodhound use http://localhost:8280/
+ config.vm.network :forwarded_port, guest: 80, host: 8280
+ # For tracd served bloodhound on port 8000, use http://localhost:8281/
+ config.vm.network :forwarded_port, guest: 8000, host: 8281
+
+ # Sharing the salt folders with the guest VM:
+ config.vm.synced_folder "salt/roots/", "/srv/"
+
+ config.vm.provision :salt do |salt|
+ # basic settings
+ salt.pillar({
+ "use_webserver" => true
+ })
+
+ salt.minion_config = "salt/minion"
+ salt.run_highstate = true
+ salt.verbose = true
+ end
+end
Added: bloodhound/trunk/salt/minion
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/minion?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/minion (added)
+++ bloodhound/trunk/salt/minion Mon May 25 16:24:27 2015
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+master: localhost
+file_client: local
Added: bloodhound/trunk/salt/roots/pillar/settings.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/pillar/settings.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/pillar/settings.sls (added)
+++ bloodhound/trunk/salt/roots/pillar/settings.sls Mon May 25 16:24:27 2015
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# comment out any projects here that you don't want loaded by default..
+enabled_projects:
+ - postgres
+ - sqlite
+
+# controls whether webserver is required:
+enable_webserver: True
+
+# these settings are not tested thoroughly with many boxes so will probably
+# need correcting
+{% if grains['oscodename'] in ['lucid', 'natty', 'maverick', 'squeeze'] %}
+postgresql: postgresql-8.4
+pg_hba_file: /etc/postgresql/8.4/main/pg_hba.conf
+pg_hba_replace: pg_hba_8.4.conf
+{% else %}
+postgresql: postgresql-9.1
+pg_hba_file: /etc/postgresql/9.1/main/pg_hba.conf
+pg_hba_replace: pg_hba_9.1.conf
+{% endif %}
+{% if grains['oscodename'] in ['lucid', 'natty', 'maverick'] %}
+postgresql_service: postgresql-8.4
+{% else %}
+postgresql_service: postgresql
+{% endif %}
+
+# add new projects to this list, enable them at the top of the file
+projects:
+ postgres:
+ dbtype: postgres
+ dbname: bhdb
+ dbuser: bloodhound
+ dbpassword: bloodhound
+ dbhost: localhost
+ dbport: 5432
+ adminuser: admin
+ adminpassword: adminpass
+ project: test
+ prodprefix: TEST
+ sqlite:
+ dbtype: sqlite
+ dbname: a
+ dbuser: a
+ dbpassword: a
+ dbhost: a
+ dbport: a
+ adminuser: admin
+ adminpassword: adminpass
+ project: test
+ prodprefix: TEST
Added: bloodhound/trunk/salt/roots/pillar/top.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/pillar/top.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/pillar/top.sls (added)
+++ bloodhound/trunk/salt/roots/pillar/top.sls Mon May 25 16:24:27 2015
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+base:
+ '*':
+ - settings
Added: bloodhound/trunk/salt/roots/salt/bloodhound/init.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/bloodhound/init.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/bloodhound/init.sls (added)
+++ bloodhound/trunk/salt/roots/salt/bloodhound/init.sls Mon May 25 16:24:27
2015
@@ -0,0 +1,99 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include:
+ - webserver
+ - requirements
+ - postgresql
+
+/home/vagrant/bhenv:
+ virtualenv.managed:
+ - no_site_packages: True
+ - user: vagrant
+ - requirements: salt://bloodhound/requirements.txt
+ - cwd: /vagrant/installer/
+ - require:
+ - pkg: python-dev
+ - pkg: python-virtualenv
+ - pkg: libpq-dev
+
+project environment requirements:
+ cmd.run:
+ - user: vagrant
+ - cwd: /vagrant/installer/
+ - name: "source /home/vagrant/bhenv/bin/activate
+ && pip install -r requirements-dev.txt"
+ - require:
+ - virtualenv: /home/vagrant/bhenv
+
+{% for project, data in pillar['projects'].items() %} {% if project in
pillar['enabled_projects'] %}
+create {{ project }} project environment:
+ cmd.run:
+ - user: vagrant
+ - unless: "test -d /home/vagrant/environments/{{ project }}"
+ - cwd: /vagrant/installer/
+ - name: "source /home/vagrant/bhenv/bin/activate &&
+ python bloodhound_setup.py
--environments_directory=/home/vagrant/environments
+ --project={{ project }}
+ --default-product-prefix={{
data['prodprefix'] }}
+ --database-type={{ data['dbtype'] }}
+ --database-name={{ data['dbname'] }}
+ --user={{ data['dbuser'] }}
+ --password={{ data['dbpassword'] }}
+ --database-port={{ data['dbport'] }}
+ --database-host={{ data['dbhost'] }}
+ --admin-user={{ data['adminuser'] }}
+ --admin-password={{
data['adminpassword'] }}"
+ - require:
+ {% if data['dbtype'] == 'postgres' %}
+ - postgres_database: bloodhounddb for {{ project }}
+ {% endif %}
+ - cmd: project environment requirements
+
+create bloodhound {{ project }} site dirs:
+ cmd.run:
+ - user: vagrant
+ - onlyif: "test -d /home/vagrant/environments/{{ project }}"
+ - cwd: /home/vagrant/environments/
+ - name: "source /home/vagrant/bhenv/bin/activate &&
+ trac-admin {{ project }} deploy {{ project }}/site"
+ - require:
+ - virtualenv: /home/vagrant/bhenv
+ - cmd: create {{ project }} project environment
+
+{% if data['dbtype'] == 'postgres' %}
+bloodhounduser for {{ project }}:
+ postgres_user.present:
+ - name: {{ data['dbuser'] }}
+ - password: {{ data['dbpassword'] }}
+ - user: postgres
+ - require:
+ - pkg: {{ pillar['postgresql'] }}
+ - service: {{ pillar['postgresql_service'] }}
+
+bloodhounddb for {{ project }}:
+ postgres_database.present:
+ - name: {{ data['dbname'] }}
+ - encoding: UTF8
+ - template: template0
+ - owner: {{ data['dbuser'] }}
+ - user: postgres
+ - require:
+ - postgres_user: bloodhounduser for {{ project }}
+{% endif %}
+
+{% endif %}{% endfor %}
Added: bloodhound/trunk/salt/roots/salt/bloodhound/requirements.txt
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/bloodhound/requirements.txt?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/bloodhound/requirements.txt (added)
+++ bloodhound/trunk/salt/roots/salt/bloodhound/requirements.txt Mon May 25
16:24:27 2015
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+psycopg2==2.4.5
Added: bloodhound/trunk/salt/roots/salt/postgresql/init.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/postgresql/init.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/postgresql/init.sls (added)
+++ bloodhound/trunk/salt/roots/salt/postgresql/init.sls Mon May 25 16:24:27
2015
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+{% set firstloop=True %}
+{% for project, data in pillar['projects'].items() %} {% if project in
pillar['enabled_projects'] and data['dbtype'] == 'postgres' %}
+
+{% if firstloop %}
+{% set firstloop=False %}
+pg_hb.conf:
+ file.managed:
+ - name: {{ pillar['pg_hba_file'] }}
+ - source: salt://postgresql/{{ pillar['pg_hba_replace'] }}
+ - template: jinja
+ - user: postgres
+ - group: postgres
+ - mode: 644
+ - require:
+ - pkg: {{ pillar['postgresql'] }}
+
+postgresql:
+ pkg:
+ - name: {{ pillar['postgresql'] }}
+ - installed
+ service.running:
+ - name: {{ pillar['postgresql_service'] }}
+ - enable: True
+ - watch:
+ - file: {{ pillar['pg_hba_file'] }}
+{% endif %}
+{% endif %} {% endfor %}
Added: bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_8.4.conf
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_8.4.conf?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_8.4.conf (added)
+++ bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_8.4.conf Mon May 25
16:24:27 2015
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+{% for project, data in pillar['projects'].items() %}{% if project in
pillar['enabled_projects'] and data['dbtype'] == 'postgres' %}
+local {{ data['dbname'] }} {{ data['dbuser'] }} md5
+{% endif %} {% endfor %}
+local all postgres ident
+local all all ident
+host all all 127.0.0.1/32 trust
+host all all ::1/128 trust
+
Added: bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_9.1.conf
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_9.1.conf?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_9.1.conf (added)
+++ bloodhound/trunk/salt/roots/salt/postgresql/pg_hba_9.1.conf Mon May 25
16:24:27 2015
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+{% for project, data in pillar['projects'].items() %}{% if project in
pillar['enabled_projects'] and data['dbtype'] == 'postgres' %}
+local {{ data['dbname'] }} {{ data['dbuser'] }} md5
+{% endif %} {% endfor %}
+local all postgres peer
+local all all peer
+host all all 127.0.0.1/32 trust
+host all all ::1/128 trust
Added: bloodhound/trunk/salt/roots/salt/requirements/init.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/requirements/init.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/requirements/init.sls (added)
+++ bloodhound/trunk/salt/roots/salt/requirements/init.sls Mon May 25 16:24:27
2015
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+packages:
+ pkg.installed:
+ - names:
+ - python-virtualenv
+ - python-dev
+ - libpq-dev
Added: bloodhound/trunk/salt/roots/salt/top.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/top.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/top.sls (added)
+++ bloodhound/trunk/salt/roots/salt/top.sls Mon May 25 16:24:27 2015
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+base:
+ '*':
+ - requirements
+ - postgresql
+ - bloodhound
Added: bloodhound/trunk/salt/roots/salt/webserver/bloodhound.site
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/webserver/bloodhound.site?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/webserver/bloodhound.site (added)
+++ bloodhound/trunk/salt/roots/salt/webserver/bloodhound.site Mon May 25
16:24:27 2015
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+<VirtualHost *:80>
+ {% for project, data in pillar['projects'].items() %} {% if project in
pillar['enabled_projects'] %}
+ WSGIDaemonProcess bh_{{ project }} user=vagrant
python-path=/home/vagrant/bhenv/lib/python2.7/site-packages
+ WSGIScriptAlias /{{ project }} /home/vagrant/environments/{{ project
}}/site/cgi-bin/trac.wsgi
+ <Directory /home/vagrant/environments/{{ project }}/site/cgi-bin>
+ WSGIProcessGroup bh_{{ project }}
+ WSGIApplicationGroup %{GLOBAL}
+ Order deny,allow
+ Allow from all
+ </Directory>
+ <LocationMatch "/{{ project }}/[^/]+/login">
+ AuthType Digest
+ AuthName "Bloodhound"
+ AuthDigestDomain /{{ project }}
+ AuthUserFile /home/vagrant/environments/{{ project }}/bloodhound.htdigest
+ Require valid-user
+ </LocationMatch>
+ {% endif %} {% endfor %}
+</VirtualHost>
Added: bloodhound/trunk/salt/roots/salt/webserver/init.sls
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/salt/roots/salt/webserver/init.sls?rev=1681607&view=auto
==============================================================================
--- bloodhound/trunk/salt/roots/salt/webserver/init.sls (added)
+++ bloodhound/trunk/salt/roots/salt/webserver/init.sls Mon May 25 16:24:27 2015
@@ -0,0 +1,81 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+{% if pillar['enable_webserver'] %}
+libapache2-mod-wsgi:
+ pkg:
+ - installed
+ - require:
+ - pkg: apache2
+
+a2enmod wsgi:
+ cmd.run:
+ - unless: test -L /etc/apache2/mods-enabled/wsgi.load
+ - watch:
+ - pkg: libapache2-mod-wsgi
+ - require:
+ - pkg: apache2
+
+a2enmod auth_digest:
+ cmd.run:
+ - unless: test -L /etc/apache2/mods-enabled/auth_digest.load
+ - require:
+ - pkg: apache2
+
+bloodhound_site:
+ file:
+ - managed
+ - template: jinja
+ - name: /etc/apache2/sites-available/bloodhound
+ - source: salt://webserver/bloodhound.site
+ - require:
+ - pkg: apache2
+
+{% if grains['os_family'] == 'Debian' %}
+a2dissite 000-default:
+ cmd.run:
+ - onlyif: test -L /etc/apache2/sites-enabled/000-default
+ - require:
+ - pkg: apache2
+{% endif %}
+
+a2ensite bloodhound:
+ cmd.run:
+ - unless: test -L /etc/apache2/sites-enabled/bloodhound
+ - watch:
+ - file: bloodhound_site
+ - require:
+ - pkg: apache2
+ - cmd: a2dissite 000-default
+ - cmd: a2enmod auth_digest
+ - cmd: a2enmod wsgi
+ {% for project, data in pillar['projects'].items() %} {% if project in
pillar['enabled_projects'] %}
+ - cmd: create bloodhound {{ project }} site dirs
+ {% endif %} {% endfor %}
+
+apache2:
+ pkg:
+ - installed
+ service:
+ - running
+ - watch:
+ - file: bloodhound_site
+ - cmd: a2ensite bloodhound
+ - require:
+ - pkg: apache2
+
+{% endif %}