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