5610d1ba9e1ce305ce3356ba9c8424dcc4e27b8a
[apex-tripleo-heat-templates.git] / docker / services / opendaylight-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized OpenDaylight API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerOpendaylightApiImage:
12     description: image
13     default: 'centos-binary-opendaylight:latest'
14     type: string
15   DockerOpendaylightConfigImage:
16     description: image
17     default: 'centos-binary-opendaylight:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   OpenDaylightBase:
48     type: ../../puppet/services/opendaylight-api.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the OpenDaylight API role.
59     value:
60       service_name: {get_attr: [OpenDaylightBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [OpenDaylightBase, role_data, config_settings]
64       step_config: &step_config
65         list_join:
66           - "\n"
67           - - get_attr: [OpenDaylightBase, role_data, step_config]
68             - "include tripleo::profile::base::neutron::opendaylight::create_cluster"
69       # BEGIN DOCKER SETTINGS
70       puppet_config:
71         config_volume: opendaylight
72         # 'file,concat,file_line,augeas' are included by default
73         puppet_tags: odl_user,tripleo::profile::base::neutron::opendaylight::configure_cluster
74         step_config: *step_config
75         config_image:
76           list_join:
77             - '/'
78             - [ {get_param: DockerNamespace}, {get_param: DockerOpendaylightConfigImage} ]
79       kolla_config:
80         /var/lib/kolla/config_files/opendaylight_api.json:
81           command: /opt/opendaylight/bin/karaf
82           config_files:
83             - source: "/var/lib/kolla/config_files/src/*"
84               dest: "/"
85               merge: true
86               preserve_properties: true
87           permissions:
88             - path: /opt/opendaylight
89               owner: odl:odl
90               recurse: true
91       docker_config:
92         step_1:
93           opendaylight_api:
94             start_order: 0
95             image: &odl_api_image
96               list_join:
97                 - '/'
98                 - [ {get_param: DockerNamespace}, {get_param: DockerOpendaylightApiImage} ]
99             privileged: false
100             net: host
101             detach: true
102             user: odl
103             restart: always
104             volumes:
105               list_concat:
106                 - {get_attr: [ContainersCommon, volumes]}
107                 -
108                   - /var/lib/kolla/config_files/opendaylight_api.json:/var/lib/kolla/config_files/config.json:ro
109                   - /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro
110             environment:
111               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
112
113       upgrade_tasks:
114         - name: Stop and disable opendaylight_api service
115           tags: step2
116           service: name=opendaylight state=stopped enabled=no