Add role specific information to the service template
[apex-tripleo-heat-templates.git] / docker / services / heat-api-cfn.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Heat API CFN service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerHeatApiCfnImage:
12     description: image
13     default: 'centos-binary-heat-api-cfn:latest'
14     type: string
15   # puppet needs the heat-wsgi-api-cfn binary from centos-binary-heat-api-cfn
16   DockerHeatConfigImage:
17     description: image
18     default: 'centos-binary-heat-api-cfn: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   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     default: {}
40     description: Parameters specific to the role
41   EnableInternalTLS:
42     type: boolean
43     default: false
44
45 conditions:
46
47   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
48
49 resources:
50
51   ContainersCommon:
52     type: ./containers-common.yaml
53
54   HeatBase:
55     type: ../../puppet/services/heat-api-cfn.yaml
56     properties:
57       EndpointMap: {get_param: EndpointMap}
58       ServiceNetMap: {get_param: ServiceNetMap}
59       DefaultPasswords: {get_param: DefaultPasswords}
60       RoleName: {get_param: RoleName}
61       RoleParameters: {get_param: RoleParameters}
62
63 outputs:
64   role_data:
65     description: Role data for the Heat API CFN role.
66     value:
67       service_name: {get_attr: [HeatBase, role_data, service_name]}
68       config_settings:
69         map_merge:
70           - get_attr: [HeatBase, role_data, config_settings]
71           - apache::default_vhost: false
72       step_config: &step_config
73         get_attr: [HeatBase, 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_api_cfn
78         puppet_tags: heat_config,file,concat,file_line
79         step_config: *step_config
80         config_image:
81           list_join:
82             - '/'
83             - [ {get_param: DockerNamespace}, {get_param: DockerHeatConfigImage} ]
84       kolla_config:
85         /var/lib/kolla/config_files/heat_api_cfn.json:
86           command: /usr/sbin/httpd -DFOREGROUND
87           permissions:
88             - path: /var/log/heat
89               owner: heat:heat
90               recurse: true
91       docker_config:
92         step_4:
93           heat_api_cfn:
94             image:
95               list_join:
96                 - '/'
97                 - [ {get_param: DockerNamespace}, {get_param: DockerHeatApiCfnImage} ]
98             net: host
99             privileged: false
100             restart: always
101             # NOTE(mandre) kolla image changes the user to 'heat', we need it
102             # to be root to run httpd
103             user: root
104             volumes:
105               list_concat:
106                 - {get_attr: [ContainersCommon, volumes]}
107                 -
108                   - /var/lib/kolla/config_files/heat_api_cfn.json:/var/lib/kolla/config_files/config.json:ro
109                   - /var/lib/config-data/heat_api_cfn/etc/heat/:/etc/heat/:ro
110                   - /var/lib/config-data/heat_api_cfn/etc/httpd/:/etc/httpd/:ro
111                   - /var/lib/config-data/heat_api_cfn/var/www/:/var/www/:ro
112                   - /var/log/containers/heat:/var/log/heat
113                   -
114                     if:
115                       - internal_tls_enabled
116                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
117                       - ''
118                   -
119                     if:
120                       - internal_tls_enabled
121                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
122                       - ''
123             environment:
124               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
125       host_prep_tasks:
126         - name: create persistent logs directory
127           file:
128             path: /var/log/containers/heat
129             state: directory
130       upgrade_tasks:
131         - name: Stop and disable heat_api_cfn service
132           tags: step2
133           service: name=httpd state=stopped enabled=no