summaryrefslogtreecommitdiffstats
path: root/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls
blob: 6e31ffb3f7291728c69f91fdd84dc8eb74f25c94 (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
50
51
##############################################################################
# Copyright (c) 2019 Mirantis Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
{% from "opendaylight/map.jinja" import server with context %}

{%- if server.enabled %}

include:
  - opendaylight.config
  - opendaylight.repo

{%- if grains['saltversioninfo'] < [2017, 7] %}
service.mask:
  module.run:
  - m_name: opendaylight
{%- else %}
opendaylight_service_mask:
  service.masked:
  - name: opendaylight
{%- endif %}
  - prereq:
    - pkg: opendaylight

{%- if server.cluster_enabled %}
configure_cluster:
  cmd.run:
  - name: /opt/opendaylight/bin/configure-cluster-ipdetect.sh {{ server.seed_nodes_list }}
  - require:
    - pkg: opendaylight
{%- endif %}

opendaylight:
  pkg.installed:
  - names: {{ server.pkgs }}
  - require:
    - sls: opendaylight.repo
  - require_in:
    - sls: opendaylight.config
  service.running:
  - enable: true
{%- if grains['saltversioninfo'] >= [2017, 7] %}
  - unmask: true
{%- endif %}
  - watch:
    - sls: opendaylight.config

{%- endif %}