include: - webserver gnuviechadmin-packages: pkg.installed: - names: - libpq-dev - libyaml-dev - python-virtualenv - python-dev - python-pip {% import "webserver/sslcert.macros.sls" as sslcert %} {% set venv = salt['pillar.get']('gnuviechadmin:virtualenv') %} {% set domainname = salt['pillar.get']('gnuviechadmin:domainname') %} {{ sslcert.key_cert(domainname) }} {{ venv }}: file.directory: - user: vagrant - group: vagrant - require: - cmd: gnuviechadmin-venv /home/vagrant/gvasettings.sh: file.managed: - user: vagrant - group: vagrant - mode: 0640 - source: salt://gnuviechadmin/gvasettings.sh - template: jinja - context: broker_url: amqp://{{ salt['pillar.get']('gnuviechadmin-queues:owner:user') }}:{{ salt['pillar.get']('gnuviechadmin-queues:owner:password') }}@mq/{{ salt['pillar.get']('gnuviechadmin-queues:vhost') }} gnuviechadmin-venv: cmd.run: - name: virtualenv {{ venv }} - user: vagrant - group: vagrant - unless: test -f {{ venv }}/bin/pip gnuviechadmin-requires: cmd.run: - name: {{ venv }}/bin/pip install -U -r requirements/local.txt && touch {{ venv }}/lastinstall - user: vagrant - group: vagrant - cwd: /vagrant - require: - file: {{ venv }} - pkg: python-dev - pkg: libpq-dev - unless: test -e {{ venv }}/lastinstall && test /vagrant/requirements/local.txt -ot {{ venv }}/lastinstall && test /vagrant/requirements/base.txt -ot {{ venv }}/lastinstall gnuviechadmin-dbschema: cmd.wait: - name: . /home/vagrant/gvasettings.sh ; {{ venv }}/bin/python manage.py migrate --noinput - user: vagrant - group: vagrant - cwd: /vagrant/gnuviechadmin - watch: - cmd: gnuviechadmin-requires - file: /home/vagrant/gvasettings.sh gnuviechadmin-locale-data-compile: cmd.wait: - name: . /home/vagrant/gvasettings.sh ; find /vagrant/gnuviechadmin -type d -name 'locale' | while read dir; do cd $(dirname "$dir") ; {{ venv }}/bin/python /vagrant/gnuviechadmin/manage.py compilemessages ; done - user: vagrant - group: vagrant - cwd: /vagrant/gnuviechadmin - require: - file: /home/vagrant/gvasettings.sh - file: {{ venv }} /etc/nginx/sites-available/{{ domainname }}: file.managed: - user: root - group: root - mode: 0640 - source: salt://gnuviechadmin/gnuviechadmin.nginx - template: jinja - context: domainname: {{ domainname }} ssl_keydir: {{ salt['pillar.get']('nginx:sslkeydir', '/etc/nginx/ssl/private') }} ssl_certdir: {{ salt['pillar.get']('nginx:sslcertdir', '/etc/nginx/ssl/certs') }} - require: - pkg: nginx - watch_in: - service: nginx /etc/nginx/sites-enabled/{{ domainname }}: file.symlink: - target: /etc/nginx/sites-available/{{ domainname }} - require: - file: /etc/nginx/sites-available/{{ domainname }} - watch_in: - service: nginx