803d8b837fcd9784faa124a346c62044dd241cfb
[apex-tripleo-heat-templates.git] / puppet / services / cinder-api.yaml
1 heat_template_version: 2016-10-14
2
3 description: >
4   OpenStack Cinder API service configured with Puppet
5
6 parameters:
7   CinderEnableDBPurge:
8     default: true
9     description: |
10       Whether to create cron job for purging soft deleted rows in Cinder database.
11     type: boolean
12   CinderPassword:
13     description: The password for the cinder service account, used by cinder-api.
14     type: string
15     hidden: true
16   ServiceNetMap:
17     default: {}
18     description: Mapping of service_name -> network name. Typically set
19                  via parameter_defaults in the resource registry.  This
20                  mapping overrides those in ServiceNetMapDefaults.
21     type: json
22   DefaultPasswords:
23     default: {}
24     type: json
25   EndpointMap:
26     default: {}
27     description: Mapping of service endpoint -> protocol. Typically set
28                  via parameter_defaults in the resource registry.
29     type: json
30   KeystoneRegion:
31     type: string
32     default: 'regionOne'
33     description: Keystone region for endpoint
34   MonitoringSubscriptionCinderApi:
35     default: 'overcloud-cinder-api'
36     type: string
37   CinderApiLoggingSource:
38     type: json
39     default:
40       tag: openstack.cinder.api
41       path: /var/log/cinder/cinder-api.log
42   CinderWorkers:
43     type: string
44     description: Set the number of workers for cinder::wsgi::apache
45     default: '"%{::os_workers}"'
46   EnableInternalTLS:
47     type: boolean
48     default: false
49
50 conditions:
51   cinder_workers_zero: {equals : [{get_param: CinderWorkers}, 0]}
52
53 resources:
54
55   ApacheServiceBase:
56     type: ./apache.yaml
57     properties:
58       ServiceNetMap: {get_param: ServiceNetMap}
59       DefaultPasswords: {get_param: DefaultPasswords}
60       EndpointMap: {get_param: EndpointMap}
61       EnableInternalTLS: {get_param: EnableInternalTLS}
62
63   CinderBase:
64     type: ./cinder-base.yaml
65     properties:
66       ServiceNetMap: {get_param: ServiceNetMap}
67       DefaultPasswords: {get_param: DefaultPasswords}
68       EndpointMap: {get_param: EndpointMap}
69
70 outputs:
71   role_data:
72     description: Role data for the Cinder API role.
73     value:
74       service_name: cinder_api
75       monitoring_subscription: {get_param: MonitoringSubscriptionCinderApi}
76       logging_source: {get_param: CinderApiLoggingSource}
77       logging_groups:
78         - cinder
79       config_settings:
80         map_merge:
81           - get_attr: [CinderBase, role_data, config_settings]
82           - get_attr: [ApacheServiceBase, role_data, config_settings]
83           - cinder::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri]}
84             cinder::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
85             cinder::keystone::authtoken::password: {get_param: CinderPassword}
86             cinder::keystone::authtoken::project_name: 'service'
87             cinder::api::enable_proxy_headers_parsing: true
88
89             cinder::api::nova_catalog_info: 'compute:Compute Service:internalURL'
90             # TODO(emilien) move it to puppet-cinder
91             cinder::config:
92               DEFAULT/swift_catalog_info:
93                 value: 'object-store:swift:internalURL'
94             cinder::glance::glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]}
95             tripleo::profile::base::cinder::cinder_enable_db_purge: {get_param: CinderEnableDBPurge}
96             tripleo.cinder_api.firewall_rules:
97               '119 cinder':
98                 dport:
99                   - 8776
100                   - 13776
101             cinder::api::bind_host:
102               str_replace:
103                 template:
104                   '"%{::fqdn_$NETWORK}"'
105                 params:
106                   $NETWORK: {get_param: [ServiceNetMap, CinderApiNetwork]}
107             cinder::wsgi::apache::ssl: {get_param: EnableInternalTLS}
108             cinder::api::service_name: 'httpd'
109             # NOTE: bind IP is found in Heat replacing the network name with the local node IP
110             # for the given network; replacement examples (eg. for internal_api):
111             # internal_api -> IP
112             # internal_api_uri -> [IP]
113             # internal_api_subnet - > IP/CIDR
114             cinder::wsgi::apache::bind_host: {get_param: [ServiceNetMap, CinderApiNetwork]}
115             cinder::wsgi::apache::servername:
116               str_replace:
117                 template:
118                   '"%{::fqdn_$NETWORK}"'
119                 params:
120                   $NETWORK: {get_param: [ServiceNetMap, CinderApiNetwork]}
121           -
122             if:
123             - cinder_workers_zero
124             - {}
125             - cinder::wsgi::apache::workers: {get_param: CinderWorkers}
126       step_config: |
127         include ::tripleo::profile::base::cinder::api
128       service_config_settings:
129         keystone:
130           cinder::keystone::auth::tenant: 'service'
131           cinder::keystone::auth::public_url: {get_param: [EndpointMap, CinderPublic, uri]}
132           cinder::keystone::auth::internal_url: {get_param: [EndpointMap, CinderInternal, uri]}
133           cinder::keystone::auth::admin_url: {get_param: [EndpointMap, CinderAdmin, uri]}
134           cinder::keystone::auth::public_url_v2: {get_param: [EndpointMap, CinderV2Public, uri]}
135           cinder::keystone::auth::internal_url_v2: {get_param: [EndpointMap, CinderV2Internal, uri]}
136           cinder::keystone::auth::admin_url_v2: {get_param: [EndpointMap, CinderV2Admin, uri]}
137           cinder::keystone::auth::public_url_v3: {get_param: [EndpointMap, CinderV3Public, uri]}
138           cinder::keystone::auth::internal_url_v3: {get_param: [EndpointMap, CinderV3Internal, uri]}
139           cinder::keystone::auth::admin_url_v3: {get_param: [EndpointMap, CinderV3Admin, uri]}
140           cinder::keystone::auth::password: {get_param: CinderPassword}
141           cinder::keystone::auth::region: {get_param: KeystoneRegion}
142         mysql:
143           cinder::db::mysql::password: {get_param: CinderPassword}
144           cinder::db::mysql::user: cinder
145           cinder::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
146           cinder::db::mysql::dbname: cinder
147           cinder::db::mysql::allowed_hosts:
148             - '%'
149             - "%{hiera('mysql_bind_host')}"