summaryrefslogtreecommitdiffstats
path: root/mcp/salt-formulas/opendaylight/server.sls
blob: cb5b3120cee1e820ba06a1c6bd8b0fca91b85ae1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{% from "opendaylight/map.jinja" import server with context %}

{%- if server.enabled %}

opendaylight_repo:
  pkgrepo.managed:
  - ppa: {{ server.repo }}

opendaylight:
  pkg.installed:
  - require:
    - pkgrepo: opendaylight_repo
  - require_in:
    - file: /opt/opendaylight/etc/jetty.xml
    - file: /opt/opendaylight/bin/setenv
    - file: /opt/opendaylight/etc/org.apache.karaf.features.cfg
  service.running:
  - enable: true
  - watch:
    - file: /opt/opendaylight/etc/jetty.xml
    - file: /opt/opendaylight/bin/setenv
    - file: /opt/opendaylight/etc/org.apache.karaf.features.cfg

/opt/opendaylight/etc/jetty.xml:
  file.managed:
  - source: salt://opendaylight/files/jetty.xml
  - template: jinja
  - user: odl
  - group: odl

/opt/opendaylight/bin/setenv:
  file.managed:
  - source: salt://opendaylight/files/setenv.shell
  - mode: 0755
  - use:
    - file: /opt/opendaylight/etc/jetty.xml

{% set features %}
{%- for f in server.karaf_features.itervalues() -%}
{{ f | join(',') }}{%- if not loop.last %},{%- endif %}
{%- endfor %}
{% endset %}

/opt/opendaylight/etc/org.apache.karaf.features.cfg:
  file.replace:
  - pattern: ^featuresBoot=.*$
  - repl: "featuresBoot={{ features }}"

{%- endif %}