Merge "Don't curl metadata server in userdata example"
[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
41 resources:
42
43   ContainersCommon:
44     type: ./containers-common.yaml
45
46   MySQLClient:
47     type: ../../puppet/services/database/mysql-client.yaml
48
49   HeatBase:
50     type: ../../puppet/services/heat-engine.yaml
51     properties:
52       EndpointMap: {get_param: EndpointMap}
53       ServiceData: {get_param: ServiceData}
54       ServiceNetMap: {get_param: ServiceNetMap}
55       DefaultPasswords: {get_param: DefaultPasswords}
56       RoleName: {get_param: RoleName}
57       RoleParameters: {get_param: RoleParameters}
58
59 outputs:
60   role_data:
61     description: Role data for the Heat Engine role.
62     value:
63       service_name: {get_attr: [HeatBase, role_data, service_name]}
64       config_settings:
65         map_merge:
66           - get_attr: [HeatBase, role_data, config_settings]
67           - apache::default_vhost: false
68       step_config: &step_config
69         list_join:
70           - "\n"
71           - - {get_attr: [HeatBase, role_data, step_config]}
72             - {get_attr: [MySQLClient, role_data, step_config]}
73       service_config_settings: {get_attr: [HeatBase, role_data, service_config_settings]}
74       # BEGIN DOCKER SETTINGS
75       puppet_config:
76         config_volume: heat
77         puppet_tags: heat_config,file,concat,file_line
78         step_config: *step_config
79         config_image: {get_param: DockerHeatConfigImage}
80       kolla_config:
81         /var/lib/kolla/config_files/heat_engine.json:
82           command: /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
83           config_files:
84             - source: "/var/lib/kolla/config_files/src/*"
85               dest: "/"
86               merge: true
87               preserve_properties: true
88           permissions:
89             - path: /var/log/heat
90               owner: heat:heat
91               recurse: true
92       docker_config:
93         # db sync runs before permissions set by kolla_config
94         step_2:
95           heat_init_log:
96             image: &heat_engine_image {get_param: DockerHeatEngineImage}
97             user: root
98             volumes:
99               - /var/log/containers/heat:/var/log/heat
100             command: ['/bin/bash', '-c', 'chown -R heat:heat /var/log/heat']
101         step_3:
102           heat_engine_db_sync:
103             image: *heat_engine_image
104             net: host
105             privileged: false
106             detach: false
107             user: root
108             volumes:
109               list_concat:
110                 - {get_attr: [ContainersCommon, volumes]}
111                 -
112                   - /var/lib/config-data/heat/etc/heat/:/etc/heat/:ro
113                   - /var/log/containers/heat:/var/log/heat
114             command: "/usr/bin/bootstrap_host_exec heat_engine su heat -s /bin/bash -c 'heat-manage db_sync'"
115         step_4:
116           heat_engine:
117             image: *heat_engine_image
118             net: host
119             privileged: false
120             restart: always
121             volumes:
122               list_concat:
123                 - {get_attr: [ContainersCommon, volumes]}
124                 -
125                   - /var/lib/kolla/config_files/heat_engine.json:/var/lib/kolla/config_files/config.json:ro
126                   - /var/lib/config-data/puppet-generated/heat/:/var/lib/kolla/config_files/src:ro
127                   - /var/log/containers/heat:/var/log/heat
128             environment:
129               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
130       host_prep_tasks:
131         - name: create persistent logs directory
132           file:
133             path: /var/log/containers/heat
134             state: directory
135       upgrade_tasks:
136         - name: Stop and disable heat_engine service
137           tags: step2
138           service: name=openstack-heat-engine state=stopped enabled=no