cubicweb/instances.sls
author David Douard <david.douard@logilab.fr>
Wed, 22 Jul 2015 14:51:15 +0200
changeset 58 f158714afa72
parent 51 0e92434f85bf
child 78 bc9fc4cffa1e
permissions -rw-r--r--
[cubicweb] use decent default values for several pillar parameters

include:
  - cubicweb

{% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
{% if 'https' in  extrasrc %}
apt-transport-https:
  pkg:
    - installed
{% break %}
{% endif %}
{% endfor %}

{% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
 {% for name, config in vhost.iteritems() %}

cw-{{vhostname}}-{{name}}:
  cubicweb_instance.present:
    - name: {{name}}
    - port: {{config.cwapp.port}}
    - anonymous-user: {{ config.cwapp.get('anonuser', '') }}
    - anonymous-password: {{ config.cwapp.get('anonpass', '') }}
    - admin/login: {{config.cwapp.adminuser}}
    - admin/password: {{config.cwapp.adminpass}}
    - cubes: {{config.cwapp.cubes.keys()}}
    - db-host: {{config.database.get('host', '')}}
    - db-port: {{config.database.get('port', '')}}
    - db-name: {{config.database.name}}
    - db-user: {{config.database.user}}
    - db-password: {{config.database.password}}
    - create_db: {{config.cwapp.get('create_db', True)}}
    - base-url: {{config.cwapp.get('basepath', '/')}}
    - require:
      - pkg: cw-{{vhostname}}-{{name}}
  pkg.installed:
    - pkgs:
        {% for pkg in config.cwapp.cubes.values() -%}
        - {{pkg}}
        {% endfor %}
    - require:
      - pkg: cw-web

cw-{{vhostname}}-{{name}}-running:
  cubicweb_instance.running:
    - name: {{name}}
    - require:
      - cubicweb_instance: cw-{{vhostname}}-{{name}}

configure cw-{{vhostname}}-{{name}}:
  ini.options_present:
    - name: /etc/cubicweb.d/{{name}}/all-in-one.conf
    - sections:
        {{ config.get('cwapp_config_options', {}) }}
    - watch_in:
      - cubicweb_instance: cw-{{vhostname}}-{{name}}-running
 {% endfor %}
{% endfor %}