Add license headers where missing
[fuel.git] / mcp / salt-formulas / opendaylight / server.sls
1 ##############################################################################
2 # Copyright (c) 2017 Mirantis Inc. and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {% from "opendaylight/map.jinja" import server with context %}
9
10 {%- if server.enabled %}
11
12 opendaylight_repo:
13   pkgrepo.managed:
14   - ppa: {{ server.repo }}
15
16 opendaylight:
17   pkg.installed:
18   - require:
19     - pkgrepo: opendaylight_repo
20   - require_in:
21     - file: /opt/opendaylight/etc/jetty.xml
22     - file: /opt/opendaylight/bin/setenv
23     - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg
24     - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg
25   service.running:
26   - enable: true
27   - watch:
28     - file: /opt/opendaylight/etc/jetty.xml
29     - file: /opt/opendaylight/bin/setenv
30     - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg
31     - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg
32
33 /opt/opendaylight/etc/jetty.xml:
34   file.managed:
35   - source: salt://opendaylight/files/jetty.xml
36   - template: jinja
37   - user: odl
38   - group: odl
39
40 /opt/opendaylight/bin/setenv:
41   file.managed:
42   - source: salt://opendaylight/files/setenv.shell
43   - mode: 0755
44   - use:
45     - file: /opt/opendaylight/etc/jetty.xml
46
47 {% set features %}
48 {%- for f in server.karaf_features.itervalues() -%}
49 {{ f | join(',') }}{%- if not loop.last %},{%- endif %}
50 {%- endfor %}
51 {% endset %}
52
53 /opt/opendaylight/etc/org.apache.karaf.features.cfg:
54   ini.options_present:
55     - sections:
56         featuresBoot: {{ features }}
57
58 /opt/opendaylight/etc/org.ops4j.pax.web.cfg:
59   ini.options_present:
60     - sections:
61         org.ops4j.pax.web.listening.addresses: {{ server.odl_bind_ip }}
62
63 {%- if server.get('router_enabled', false) %}
64 /opt/opendaylight/etc/custom.properties:
65   ini.options_present:
66     - sections:
67         ovsdb.l3.fwd.enabled: 'yes'
68         ovsdb.of.version: 1.3
69     - require:
70       - pkg: opendaylight
71     - watch_in:
72       - service: opendaylight
73 {%- endif %}
74
75 {%- endif %}