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