Add role specific information to the service template
[apex-tripleo-heat-templates.git] / puppet / services / gnocchi-api.yaml
1 heat_template_version: ocata
2
3 description: >
4   Gnocchi service configured with Puppet
5
6 parameters:
7   ServiceNetMap:
8     default: {}
9     description: Mapping of service_name -> network name. Typically set
10                  via parameter_defaults in the resource registry.  This
11                  mapping overrides those in ServiceNetMapDefaults.
12     type: json
13   DefaultPasswords:
14     default: {}
15     type: json
16   RoleName:
17     default: ''
18     description: Role name on which the service is applied
19     type: string
20   RoleParameters:
21     default: {}
22     description: Parameters specific to the role
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   GnocchiPassword:
30     description: The password for the gnocchi service and db account.
31     type: string
32     hidden: true
33   GnocchiBackend:
34     default: swift
35     description: The short name of the Gnocchi backend to use. Should be one
36       of swift, rbd, or file
37     type: string
38     constraints:
39     - allowed_values: ['swift', 'file', 'rbd']
40   KeystoneRegion:
41     type: string
42     default: 'regionOne'
43     description: Keystone region for endpoint
44   MonitoringSubscriptionGnocchiApi:
45     default: 'overcloud-gnocchi-api'
46     type: string
47   GnocchiApiLoggingSource:
48     type: json
49     default:
50       tag: openstack.gnocchi.api
51       path: /var/log/gnocchi/app.log
52   EnableInternalTLS:
53     type: boolean
54     default: false
55   GnocchiApiPolicies:
56     description: |
57       A hash of policies to configure for Gnocchi API.
58       e.g. { gnocchi-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
59     default: {}
60     type: json
61
62 resources:
63
64   GnocchiServiceBase:
65     type: ./gnocchi-base.yaml
66     properties:
67       ServiceNetMap: {get_param: ServiceNetMap}
68       DefaultPasswords: {get_param: DefaultPasswords}
69       EndpointMap: {get_param: EndpointMap}
70       RoleName: {get_param: RoleName}
71       RoleParameters: {get_param: RoleParameters}
72
73   ApacheServiceBase:
74     type: ./apache.yaml
75     properties:
76       ServiceNetMap: {get_param: ServiceNetMap}
77       DefaultPasswords: {get_param: DefaultPasswords}
78       EndpointMap: {get_param: EndpointMap}
79       RoleName: {get_param: RoleName}
80       RoleParameters: {get_param: RoleParameters}
81       EnableInternalTLS: {get_param: EnableInternalTLS}
82
83 outputs:
84   role_data:
85     description: Role data for the Gnocchi role.
86     value:
87       service_name: gnocchi_api
88       monitoring_subscription: {get_param: MonitoringSubscriptionGnocchiApi}
89       logging_source: {get_param: GnocchiApiLoggingSource}
90       logging_groups:
91         - gnocchi
92       config_settings:
93         map_merge:
94           - get_attr: [ApacheServiceBase, role_data, config_settings]
95           - get_attr: [GnocchiServiceBase, role_data, config_settings]
96           - tripleo.gnocchi_api.firewall_rules:
97               '129 gnocchi-api':
98                 dport:
99                   - 8041
100                   - 13041
101             gnocchi::api::enabled: true
102             gnocchi::api::enable_proxy_headers_parsing: true
103             gnocchi::api::service_name: 'httpd'
104             gnocchi::policy::policies: {get_param: GnocchiApiPolicies}
105             gnocchi::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
106             gnocchi::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
107             gnocchi::keystone::authtoken::password: {get_param: GnocchiPassword}
108             gnocchi::keystone::authtoken::project_name: 'service'
109             gnocchi::keystone::authtoken::user_domain_name: 'Default'
110             gnocchi::keystone::authtoken::project_domain_name: 'Default'
111             gnocchi::wsgi::apache::ssl: {get_param: EnableInternalTLS}
112             gnocchi::wsgi::apache::servername:
113               str_replace:
114                 template:
115                   "%{hiera('fqdn_$NETWORK')}"
116                 params:
117                   $NETWORK: {get_param: [ServiceNetMap, GnocchiApiNetwork]}
118             tripleo::profile::base::gnocchi::api::gnocchi_backend: {get_param: GnocchiBackend}
119             # NOTE: bind IP is found in Heat replacing the network name with the
120             # local node IP for the given network; replacement examples
121             # (eg. for internal_api):
122             # internal_api -> IP
123             # internal_api_uri -> [IP]
124             # internal_api_subnet - > IP/CIDR
125             gnocchi::wsgi::apache::bind_host: {get_param: [ServiceNetMap, GnocchiApiNetwork]}
126             gnocchi::wsgi::apache::wsgi_process_display_name: 'gnocchi_wsgi'
127       step_config: |
128         include ::tripleo::profile::base::gnocchi::api
129       service_config_settings:
130         keystone:
131           gnocchi::keystone::auth::admin_url: { get_param: [ EndpointMap, GnocchiAdmin, uri ] }
132           gnocchi::keystone::auth::internal_url: {get_param: [EndpointMap, GnocchiInternal, uri]}
133           gnocchi::keystone::auth::password: {get_param: GnocchiPassword}
134           gnocchi::keystone::auth::public_url: { get_param: [ EndpointMap, GnocchiPublic, uri ] }
135           gnocchi::keystone::auth::region: {get_param: KeystoneRegion}
136           gnocchi::keystone::auth::tenant: 'service'
137         mysql:
138           gnocchi::db::mysql::password: {get_param: GnocchiPassword}
139           gnocchi::db::mysql::user: gnocchi
140           gnocchi::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
141           gnocchi::db::mysql::dbname: gnocchi
142           gnocchi::db::mysql::allowed_hosts:
143             - '%'
144             - "%{hiera('mysql_bind_host')}"
145       metadata_settings:
146         get_attr: [ApacheServiceBase, role_data, metadata_settings]
147       upgrade_tasks:
148         yaql:
149           expression: $.data.apache_upgrade + $.data.gnocchi_api_upgrade
150           data:
151             apache_upgrade:
152               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
153             gnocchi_api_upgrade:
154               - name: Stop gnocchi_api service (running under httpd)
155                 tags: step1
156                 service: name=httpd state=stopped