Change flat network name for nosdn fdio scenario
[apex-tripleo-heat-templates.git] / puppet / services / heat-api-cfn.yaml
1 heat_template_version: pike
2
3 description: >
4   Openstack Heat CloudFormation API service configured with Puppet
5
6 parameters:
7   ServiceData:
8     default: {}
9     description: Dictionary packing service data
10     type: json
11   ServiceNetMap:
12     default: {}
13     description: Mapping of service_name -> network name. Typically set
14                  via parameter_defaults in the resource registry.  This
15                  mapping overrides those in ServiceNetMapDefaults.
16     type: json
17   DefaultPasswords:
18     default: {}
19     type: json
20   RoleName:
21     default: ''
22     description: Role name on which the service is applied
23     type: string
24   RoleParameters:
25     default: {}
26     description: Parameters specific to the role
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   HeatWorkers:
34     default: 0
35     description: Number of workers for Heat service.
36     type: number
37   HeatPassword:
38     description: The password for the Heat service and db account, used by the Heat services.
39     type: string
40     hidden: true
41   KeystoneRegion:
42     type: string
43     default: 'regionOne'
44     description: Keystone region for endpoint
45   MonitoringSubscriptionHeatApiCnf:
46     default: 'overcloud-heat-api-cfn'
47     type: string
48   HeatApiCfnLoggingSource:
49     type: json
50     default:
51       tag: openstack.heat.api.cfn
52       path: /var/log/heat/heat-api-cfn.log
53   EnableInternalTLS:
54     type: boolean
55     default: false
56
57 conditions:
58   heat_workers_zero: {equals : [{get_param: HeatWorkers}, 0]}
59
60 resources:
61
62   ApacheServiceBase:
63     type: ./apache.yaml
64     properties:
65       ServiceData: {get_param: ServiceData}
66       ServiceNetMap: {get_param: ServiceNetMap}
67       DefaultPasswords: {get_param: DefaultPasswords}
68       EndpointMap: {get_param: EndpointMap}
69       RoleName: {get_param: RoleName}
70       RoleParameters: {get_param: RoleParameters}
71       EnableInternalTLS: {get_param: EnableInternalTLS}
72
73   HeatBase:
74     type: ./heat-base.yaml
75     properties:
76       ServiceData: {get_param: ServiceData}
77       ServiceNetMap: {get_param: ServiceNetMap}
78       DefaultPasswords: {get_param: DefaultPasswords}
79       EndpointMap: {get_param: EndpointMap}
80       RoleName: {get_param: RoleName}
81       RoleParameters: {get_param: RoleParameters}
82
83 outputs:
84   role_data:
85     description: Role data for the Heat CloudFormation API role.
86     value:
87       service_name: heat_api_cfn
88       monitoring_subscription: {get_param: MonitoringSubscriptionHeatApiCnf}
89       logging_source: {get_param: HeatApiCfnLoggingSource}
90       logging_groups:
91         - heat
92       config_settings:
93         map_merge:
94           - get_attr: [HeatBase, role_data, config_settings]
95           - get_attr: [ApacheServiceBase, role_data, config_settings]
96           - tripleo.heat_api_cfn.firewall_rules:
97               '125 heat_cfn':
98                 dport:
99                   - 8000
100                   - 13800
101             heat::api_cfn::bind_host: {get_param: [ServiceNetMap, HeatApiCfnNetwork]}
102             heat::wsgi::apache_api_cfn::ssl: {get_param: EnableInternalTLS}
103             heat::api_cfn::service_name: 'httpd'
104             # NOTE: bind IP is found in Heat replacing the network name with the local node IP
105             # for the given network; replacement examples (eg. for internal_api):
106             # internal_api -> IP
107             # internal_api_uri -> [IP]
108             # internal_api_subnet - > IP/CIDR
109             heat::wsgi::apache_api_cfn::bind_host: {get_param: [ServiceNetMap, HeatApiCfnNetwork]}
110             heat::wsgi::apache_api_cfn::servername:
111               str_replace:
112                 template:
113                   "%{hiera('fqdn_$NETWORK')}"
114                 params:
115                   $NETWORK: {get_param: [ServiceNetMap, HeatApiCfnNetwork]}
116           -
117             if:
118             - heat_workers_zero
119             - {}
120             - heat::wsgi::apache_api_cfn::workers: {get_param: HeatWorkers}
121       step_config: |
122         include ::tripleo::profile::base::heat::api_cfn
123       service_config_settings:
124         keystone:
125           map_merge:
126             - get_attr: [HeatBase, role_data, service_config_settings, keystone]
127             - heat::keystone::auth_cfn::tenant: 'service'
128               heat::keystone::auth_cfn::public_url: {get_param: [EndpointMap, HeatCfnPublic, uri]}
129               heat::keystone::auth_cfn::internal_url: {get_param: [EndpointMap, HeatCfnInternal, uri]}
130               heat::keystone::auth_cfn::admin_url: {get_param: [EndpointMap, HeatCfnAdmin, uri]}
131               heat::keystone::auth_cfn::password: {get_param: HeatPassword}
132               heat::keystone::auth_cfn::region: {get_param: KeystoneRegion}
133       metadata_settings:
134         get_attr: [ApacheServiceBase, role_data, metadata_settings]
135       upgrade_tasks:
136         - name: Check if heat_api_cfn is deployed
137           command: systemctl is-enabled openstack-heat-api-cfn
138           tags: common
139           ignore_errors: True
140           register: heat_api_cfn_enabled
141         - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running"
142           shell: /usr/bin/systemctl show 'openstack-heat-api-cfn' --property ActiveState | grep '\bactive\b'
143           when: heat_api_cfn_enabled.rc == 0
144           tags: step0,validation
145         - name: check for heat_api_cfn running under apache (post upgrade)
146           tags: step1
147           shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
148           register: heat_api_cfn_apache
149           ignore_errors: true
150         - name: Stop heat_api_cfn service (running under httpd)
151           tags: step1
152           service: name=httpd state=stopped
153           when: heat_api_cfn_apache.rc == 0
154         - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
155           tags: step1
156           when: heat_api_cfn_enabled.rc == 0
157           service: name=openstack-heat-api-cfn state=stopped enabled=no