Merge "reclass: apt_mk_version: 2017.12" into stable/euphrates
[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 {% from "linux/map.jinja" import system with context %}
10
11 {%- if server.enabled %}
12
13 opendaylight_repo_key:
14   cmd.run:
15     - name: "apt-key adv --keyserver keyserver.ubuntu.com --recv 49B07274951063870A8B7EAE7B8AA1A344C05248"
16     - env:
17       - http_proxy: {{ system.proxy.get('keyserver', {}).get('http', None) }}
18       - https_proxy: {{ system.proxy.get('keyserver', {}).get('https', None) }}
19
20 opendaylight_repo:
21   pkgrepo.managed:
22   # NOTE(armband): PPA handling behind proxy broken, define it explicitly
23   # https://github.com/saltstack/salt/pull/45224
24   # - ppa: {{ server.repo }}
25   - human_name: opendaylight-ppa
26   - name: deb http://ppa.launchpad.net/odl-team/nitrogen/ubuntu xenial main
27   - file: /etc/apt/sources.list.d/odl-team-ubuntu-nitrogen-xenial.list
28
29 opendaylight:
30   pkg.installed:
31   - require:
32     - pkgrepo: opendaylight_repo
33   - require_in:
34     - file: /opt/opendaylight/etc/jetty.xml
35     - file: /opt/opendaylight/bin/setenv
36     - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg
37     - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg
38   service.running:
39   - enable: true
40   - watch:
41     - file: /opt/opendaylight/etc/jetty.xml
42     - file: /opt/opendaylight/bin/setenv
43     - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg
44     - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg
45
46 /opt/opendaylight/etc/jetty.xml:
47   file.managed:
48   - source: salt://opendaylight/files/jetty.xml
49   - template: jinja
50   - user: odl
51   - group: odl
52
53 /opt/opendaylight/bin/setenv:
54   file.managed:
55   - source: salt://opendaylight/files/setenv.shell
56   - mode: 0755
57   - use:
58     - file: /opt/opendaylight/etc/jetty.xml
59
60 {% set features %}
61 {%- for f in server.karaf_features.itervalues() -%}
62 {{ f | join(',') }}{%- if not loop.last %},{%- endif %}
63 {%- endfor %}
64 {% endset %}
65
66 /opt/opendaylight/etc/org.apache.karaf.features.cfg:
67   ini.options_present:
68     - sections:
69         featuresBoot: {{ features }}
70
71 /opt/opendaylight/etc/org.ops4j.pax.web.cfg:
72   ini.options_present:
73     - sections:
74         org.ops4j.pax.web.listening.addresses: {{ server.odl_bind_ip }}
75
76 {%- if server.get('router_enabled', false) %}
77 /opt/opendaylight/etc/custom.properties:
78   ini.options_present:
79     - sections:
80         ovsdb.l3.fwd.enabled: 'yes'
81         ovsdb.of.version: 1.3
82     - require:
83       - pkg: opendaylight
84     - watch_in:
85       - service: opendaylight
86 {%- endif %}
87
88 {%- endif %}