Merge "Support for Satellite Capsule in rhel-registration" into stable/pike
[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   DockerHeatApiCfnImage:
8     description: image
9     type: string
10   # puppet needs the heat-wsgi-api-cfn binary from centos-binary-heat-api-cfn
11   DockerHeatApiCfnConfigImage:
12     description: The container image to use for the heat_api_cfn 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   ServiceData:
20     default: {}
21     description: Dictionary packing service data
22     type: json
23   ServiceNetMap:
24     default: {}
25     description: Mapping of service_name -> network name. Typically set
26                  via parameter_defaults in the resource registry.  This
27                  mapping overrides those in ServiceNetMapDefaults.
28     type: json
29   DefaultPasswords:
30     default: {}
31     type: json
32   RoleName:
33     default: ''
34     description: Role name on which the service is applied
35     type: string
36   RoleParameters:
37     default: {}
38     description: Parameters specific to the role
39     type: json
40   EnableInternalTLS:
41     type: boolean
42     default: false
43
44 conditions:
45
46   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
47
48 resources:
49
50   ContainersCommon:
51     type: ./containers-common.yaml
52
53   HeatBase:
54     type: ../../puppet/services/heat-api-cfn.yaml
55     properties:
56       EndpointMap: {get_param: EndpointMap}
57       ServiceData: {get_param: ServiceData}
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       logging_source: {get_attr: [HeatBase, role_data, logging_source]}
73       logging_groups: {get_attr: [HeatBase, role_data, logging_groups]}
74       step_config: &step_config
75         get_attr: [HeatBase, role_data, step_config]
76       service_config_settings: {get_attr: [HeatBase, role_data, service_config_settings]}
77       # BEGIN DOCKER SETTINGS
78       puppet_config:
79         config_volume: heat_api_cfn
80         puppet_tags: heat_config,file,concat,file_line
81         step_config: *step_config
82         config_image: {get_param: DockerHeatApiCfnConfigImage}
83       kolla_config:
84         /var/lib/kolla/config_files/heat_api_cfn.json:
85           command: /usr/sbin/httpd -DFOREGROUND
86           config_files:
87             - source: "/var/lib/kolla/config_files/src/*"
88               dest: "/"
89               merge: true
90               preserve_properties: true
91           permissions:
92             - path: /var/log/heat
93               owner: heat:heat
94               recurse: true
95       docker_config:
96         step_4:
97           heat_api_cfn:
98             image: {get_param: DockerHeatApiCfnImage}
99             net: host
100             privileged: false
101             restart: always
102             # NOTE(mandre) kolla image changes the user to 'heat', we need it
103             # to be root to run httpd
104             user: root
105             volumes:
106               list_concat:
107                 - {get_attr: [ContainersCommon, volumes]}
108                 -
109                   - /var/lib/kolla/config_files/heat_api_cfn.json:/var/lib/kolla/config_files/config.json:ro
110                   - /var/lib/config-data/puppet-generated/heat_api_cfn/:/var/lib/kolla/config_files/src:ro
111                   - /var/log/containers/heat:/var/log/heat
112                   - /var/log/containers/httpd/heat-api-cfn:/var/log/httpd
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: "{{ item }}"
129             state: directory
130           with_items:
131             - /var/log/containers/heat
132             - /var/log/containers/httpd/heat-api-cfn
133       upgrade_tasks:
134         - name: Check if heat_api_cfn is deployed
135           command: systemctl is-enabled openstack-heat-api-cfn
136           tags: common
137           ignore_errors: True
138           register: heat_api_cfn_enabled
139         - name: check for heat_api_cfn running under apache (post upgrade)
140           tags: step2
141           shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
142           register: heat_api_cfn_apache
143           ignore_errors: true
144           changed_when: false
145           check_mode: no
146         - name: Stop heat_api_cfn service (running under httpd)
147           tags: step2
148           service: name=httpd state=stopped
149           when: heat_api_cfn_apache.rc == 0
150         - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
151           tags: step2
152           service: name=openstack-heat-api-cfn state=stopped enabled=no
153           when: heat_api_cfn_enabled.rc == 0
154       metadata_settings:
155         get_attr: [HeatBase, role_data, metadata_settings]