Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / docker / services / heat-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Heat API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerHeatApiImage:
12     description: image
13     default: 'centos-binary-heat-api:latest'
14     type: string
15   # puppet needs the heat-wsgi-api binary from centos-binary-heat-api
16   DockerHeatApiConfigImage:
17     description: The container image to use for the heat_api config_volume
18     default: 'centos-binary-heat-api:latest'
19     type: string
20   EndpointMap:
21     default: {}
22     description: Mapping of service endpoint -> protocol. Typically set
23                  via parameter_defaults in the resource registry.
24     type: json
25   ServiceData:
26     default: {}
27     description: Dictionary packing service data
28     type: json
29   ServiceNetMap:
30     default: {}
31     description: Mapping of service_name -> network name. Typically set
32                  via parameter_defaults in the resource registry.  This
33                  mapping overrides those in ServiceNetMapDefaults.
34     type: json
35   DefaultPasswords:
36     default: {}
37     type: json
38   RoleName:
39     default: ''
40     description: Role name on which the service is applied
41     type: string
42   RoleParameters:
43     default: {}
44     description: Parameters specific to the role
45     type: json
46   EnableInternalTLS:
47     type: boolean
48     default: false
49
50 conditions:
51
52   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
53
54 resources:
55
56   ContainersCommon:
57     type: ./containers-common.yaml
58
59   HeatBase:
60     type: ../../puppet/services/heat-api.yaml
61     properties:
62       EndpointMap: {get_param: EndpointMap}
63       ServiceData: {get_param: ServiceData}
64       ServiceNetMap: {get_param: ServiceNetMap}
65       DefaultPasswords: {get_param: DefaultPasswords}
66       RoleName: {get_param: RoleName}
67       RoleParameters: {get_param: RoleParameters}
68
69 outputs:
70   role_data:
71     description: Role data for the Heat API role.
72     value:
73       service_name: {get_attr: [HeatBase, role_data, service_name]}
74       config_settings:
75         map_merge:
76           - get_attr: [HeatBase, role_data, config_settings]
77           - apache::default_vhost: false
78       step_config: &step_config
79         get_attr: [HeatBase, role_data, step_config]
80       service_config_settings: {get_attr: [HeatBase, role_data, service_config_settings]}
81       # BEGIN DOCKER SETTINGS
82       puppet_config:
83         config_volume: heat_api
84         puppet_tags: heat_config,file,concat,file_line
85         step_config: *step_config
86         config_image:
87           list_join:
88             - '/'
89             - [ {get_param: DockerNamespace}, {get_param: DockerHeatApiConfigImage} ]
90       kolla_config:
91         /var/lib/kolla/config_files/heat_api.json:
92           command: /usr/sbin/httpd -DFOREGROUND
93           config_files:
94             - source: "/var/lib/kolla/config_files/src/*"
95               dest: "/"
96               merge: true
97               preserve_properties: true
98           permissions:
99             - path: /var/log/heat
100               owner: heat:heat
101               recurse: true
102       docker_config:
103         step_4:
104           heat_api:
105             image:
106               list_join:
107                 - '/'
108                 - [ {get_param: DockerNamespace}, {get_param: DockerHeatApiImage} ]
109             net: host
110             privileged: false
111             restart: always
112             # NOTE(mandre) kolla image changes the user to 'heat', we need it
113             # to be root to run httpd
114             user: root
115             volumes:
116               list_concat:
117                 - {get_attr: [ContainersCommon, volumes]}
118                 -
119                   - /var/lib/kolla/config_files/heat_api.json:/var/lib/kolla/config_files/config.json:ro
120                   - /var/lib/config-data/puppet-generated/heat_api/:/var/lib/kolla/config_files/src:ro
121                   - /var/log/containers/heat:/var/log/heat
122                   -
123                     if:
124                       - internal_tls_enabled
125                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
126                       - ''
127                   -
128                     if:
129                       - internal_tls_enabled
130                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
131                       - ''
132             environment:
133               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
134       host_prep_tasks:
135         - name: create persistent logs directory
136           file:
137             path: /var/log/containers/heat
138             state: directory
139       upgrade_tasks:
140         - name: Stop and disable heat_api service
141           tags: step2
142           service: name=httpd state=stopped enabled=no
143       metadata_settings:
144         get_attr: [HeatBase, role_data, metadata_settings]