gvasalt/states/gnuviechadmin/base.sls
Jan Dittberner 7ec29b9ce2 Make gvafile deployment work
This commit refactors to gnuviechadmin.base state by moving the Django
specific parts into gnuviechadmin.django that is now used by
gnuviechadmin.gvaldap and gnuviechadmin.webinterface. The script
templates gnuviechadmin/gvafile/run_celery.sh and
gnuviechadmin/gvafile/settings.sh have been added.
2016-02-06 14:23:05 +01:00

62 lines
1.9 KiB
Text

{% from 'gnuviechadmin/vars.sls' import home, gva_component, gva_amqp_user, checkout, appdir, venv %}
{% for host in salt['pillar.get']('gnuviechadmin:machines') %}
{{ host }}:
host.present:
- ip: {{ salt['pillar.get']('gnuviechadmin:machines:%s:ip' % host) }}
{% if salt['pillar.get']('gnuviechadmin:machines:%s:names' % host) %}
- names:
{% for machine in salt['pillar.get']('gnuviechadmin:machines:%s:names' % host) %}
- {{ machine }}
{% endfor %}
{% endif %}
{% endfor %}
gnuviechadmin-packages:
pkg.installed:
- pkgs:
- libyaml-dev
- python-virtualenv
- python-dev
- python-pip
- gettext
{{ home }}/gvasettings.sh:
file.managed:
- user: vagrant
- group: vagrant
- mode: 0640
- source: salt://gnuviechadmin/{{ gva_component }}/settings.sh
- template: jinja
- context:
broker_url: {{ 'amqp://%s:%s@mq/%s' % (gva_amqp_user, salt['pillar.get']('gnuviechadmin:queues:users:%s:password' % gva_amqp_user), 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: {{ checkout }}
- require:
- cmd: gnuviechadmin-venv
- pkg: gnuviechadmin-packages
- unless: test -e {{ venv }}/lastinstall && test {{ checkout }}/requirements/local.txt -ot {{ venv }}/lastinstall && test {{ checkout }}/requirements/base.txt -ot {{ venv }}/lastinstall
/home/vagrant/.bash_functions:
file.managed:
- user: vagrant
- group: vagrant
- mode: 0644
- source: salt://base/bash_functions
- template: jinja
- context:
home: {{ home }}
venv: {{ venv }}
appdir: {{ appdir }}