Containers: Bind mount directories with the key/certs for heat
[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   DockerHeatConfigImage:
17     description: image
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   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.  This
29                  mapping overrides those in ServiceNetMapDefaults.
30     type: json
31   DefaultPasswords:
32     default: {}
33     type: json
34   EnableInternalTLS:
35     type: boolean
36     default: false
37
38 conditions:
39
40   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
41
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   HeatBase:
48     type: ../../puppet/services/heat-api.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53
54 outputs:
55   role_data:
56     description: Role data for the Heat API role.
57     value:
58       service_name: {get_attr: [HeatBase, role_data, service_name]}
59       config_settings:
60         map_merge:
61           - get_attr: [HeatBase, role_data, config_settings]
62           - apache::default_vhost: false
63       step_config: &step_config
64         get_attr: [HeatBase, role_data, step_config]
65       service_config_settings: {get_attr: [HeatBase, role_data, service_config_settings]}
66       # BEGIN DOCKER SETTINGS
67       puppet_config:
68         config_volume: heat_api
69         puppet_tags: heat_config,file,concat,file_line
70         step_config: *step_config
71         config_image:
72           list_join:
73             - '/'
74             - [ {get_param: DockerNamespace}, {get_param: DockerHeatConfigImage} ]
75       kolla_config:
76         /var/lib/kolla/config_files/heat_api.json:
77           command: /usr/sbin/httpd -DFOREGROUND
78           permissions:
79             - path: /var/log/heat
80               owner: heat:heat
81               recurse: true
82       docker_config:
83         step_4:
84           heat_api:
85             image:
86               list_join:
87                 - '/'
88                 - [ {get_param: DockerNamespace}, {get_param: DockerHeatApiImage} ]
89             net: host
90             privileged: false
91             restart: always
92             # NOTE(mandre) kolla image changes the user to 'heat', we need it
93             # to be root to run httpd
94             user: root
95             volumes:
96               list_concat:
97                 - {get_attr: [ContainersCommon, volumes]}
98                 -
99                   - /var/lib/kolla/config_files/heat_api.json:/var/lib/kolla/config_files/config.json:ro
100                   - /var/lib/config-data/heat_api/etc/heat/:/etc/heat/:ro
101                   - /var/lib/config-data/heat_api/etc/httpd/:/etc/httpd/:ro
102                   - /var/lib/config-data/heat_api/var/www/:/var/www/:ro
103                   - /var/log/containers/heat:/var/log/heat
104                   -
105                     if:
106                       - internal_tls_enabled
107                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
108                       - ''
109                   -
110                     if:
111                       - internal_tls_enabled
112                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
113                       - ''
114             environment:
115               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
116       host_prep_tasks:
117         - name: create persistent logs directory
118           file:
119             path: /var/log/containers/heat
120             state: directory
121       upgrade_tasks:
122         - name: Stop and disable heat_api service
123           tags: step2
124           service: name=httpd state=stopped enabled=no