Merge "Create mysql user for non-ha deployments" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / heat-engine.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Heat Engine service
5
6 parameters:
7   DockerHeatEngineImage:
8     description: image
9     type: string
10   DockerHeatConfigImage:
11     description: The container image to use for the heat config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40 resources:
41
42   ContainersCommon:
43     type: ./containers-common.yaml
44
45   MySQLClient:
46     type: ../../puppet/services/database/mysql-client.yaml
47
48   HeatBase:
49     type: ../../puppet/services/heat-engine.yaml
50     properties:
51       EndpointMap: {get_param: EndpointMap}
52       ServiceData: {get_param: ServiceData}
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 Engine 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       logging_source: {get_attr: [HeatBase, role_data, logging_source]}
68       logging_groups: {get_attr: [HeatBase, role_data, logging_groups]}
69       step_config: &step_config
70         list_join:
71           - "\n"
72           - - {get_attr: [HeatBase, role_data, step_config]}
73             - {get_attr: [MySQLClient, role_data, step_config]}
74       service_config_settings: {get_attr: [HeatBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS
76       puppet_config:
77         config_volume: heat
78         puppet_tags: heat_config,file,concat,file_line
79         step_config: *step_config
80         config_image: {get_param: DockerHeatConfigImage}
81       kolla_config:
82         /var/lib/kolla/config_files/heat_engine.json:
83           command: /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
84           config_files:
85             - source: "/var/lib/kolla/config_files/src/*"
86               dest: "/"
87               merge: true
88               preserve_properties: true
89           permissions:
90             - path: /var/log/heat
91               owner: heat:heat
92               recurse: true
93       docker_config:
94         # db sync runs before permissions set by kolla_config
95         step_2:
96           heat_init_log:
97             image: &heat_engine_image {get_param: DockerHeatEngineImage}
98             user: root
99             volumes:
100               - /var/log/containers/heat:/var/log/heat
101             command: ['/bin/bash', '-c', 'chown -R heat:heat /var/log/heat']
102         step_3:
103           heat_engine_db_sync:
104             image: *heat_engine_image
105             net: host
106             privileged: false
107             detach: false
108             user: root
109             volumes:
110               list_concat:
111                 - {get_attr: [ContainersCommon, volumes]}
112                 -
113                   - /var/lib/config-data/heat/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
114                   - /var/lib/config-data/heat/etc/heat/:/etc/heat/:ro
115                   - /var/log/containers/heat:/var/log/heat
116             command: "/usr/bin/bootstrap_host_exec heat_engine su heat -s /bin/bash -c 'heat-manage db_sync'"
117         step_4:
118           heat_engine:
119             image: *heat_engine_image
120             net: host
121             privileged: false
122             restart: always
123             volumes:
124               list_concat:
125                 - {get_attr: [ContainersCommon, volumes]}
126                 -
127                   - /var/lib/kolla/config_files/heat_engine.json:/var/lib/kolla/config_files/config.json:ro
128                   - /var/lib/config-data/puppet-generated/heat/:/var/lib/kolla/config_files/src:ro
129                   - /var/log/containers/heat:/var/log/heat
130             environment:
131               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
132       host_prep_tasks:
133         - name: create persistent logs directory
134           file:
135             path: /var/log/containers/heat
136             state: directory
137       upgrade_tasks:
138         - name: Stop and disable heat_engine service
139           tags: step2
140           service: name=openstack-heat-engine state=stopped enabled=no