Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / puppet / services / nova-placement.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Nova Placement 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   NovaWorkers:
34     default: 0
35     description: Number of workers for Nova services.
36     type: number
37   NovaPassword:
38     description: The password for the nova service and db account, used by nova-placement.
39     type: string
40     hidden: true
41   KeystoneRegion:
42     type: string
43     default: 'regionOne'
44     description: Keystone region for endpoint
45   MonitoringSubscriptionNovaPlacement:
46     default: 'overcloud-nova-placement'
47     type: string
48   NovaPlacementLoggingSource:
49     type: json
50     default:
51       tag: openstack.nova.placement
52       path: /var/log/httpd/nova_placement_wsgi_error_ssl.log
53   EnableInternalTLS:
54     type: boolean
55     default: false
56
57 conditions:
58   nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]}
59
60 resources:
61   ApacheServiceBase:
62     type: ./apache.yaml
63     properties:
64       ServiceData: {get_param: ServiceData}
65       ServiceNetMap: {get_param: ServiceNetMap}
66       DefaultPasswords: {get_param: DefaultPasswords}
67       EndpointMap: {get_param: EndpointMap}
68       RoleName: {get_param: RoleName}
69       RoleParameters: {get_param: RoleParameters}
70       EnableInternalTLS: {get_param: EnableInternalTLS}
71
72   NovaBase:
73     type: ./nova-base.yaml
74     properties:
75       ServiceData: {get_param: ServiceData}
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
82 outputs:
83   role_data:
84     description: Role data for the Nova Placement API service.
85     value:
86       service_name: nova_placement
87       monitoring_subscription: {get_param: MonitoringSubscriptionNovaPlacement}
88       logging_source: {get_param: NovaPlacementLoggingSource}
89       logging_groups:
90         - nova
91       config_settings:
92         map_merge:
93         - get_attr: [NovaBase, role_data, config_settings]
94         - get_attr: [ApacheServiceBase, role_data, config_settings]
95         - tripleo.nova_placement.firewall_rules:
96             '138 nova_placement':
97               dport:
98                 - 8778
99                 - 13778
100           nova::keystone::authtoken::project_name: 'service'
101           nova::keystone::authtoken::password: {get_param: NovaPassword}
102           nova::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri] }
103           nova::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
104           nova::wsgi::apache_placement::api_port: '8778'
105           nova::wsgi::apache_placement::ssl: {get_param: EnableInternalTLS}
106           # NOTE: bind IP is found in Heat replacing the network name with the local node IP
107           # for the given network; replacement examples (eg. for internal_api):
108           # internal_api -> IP
109           # internal_api_uri -> [IP]
110           # internal_api_subnet - > IP/CIDR
111           nova::wsgi::apache_placement::bind_host: {get_param: [ServiceNetMap, NovaPlacementNetwork]}
112           nova::wsgi::apache_placement::servername:
113             str_replace:
114               template:
115                 "%{hiera('fqdn_$NETWORK')}"
116               params:
117                 $NETWORK: {get_param: [ServiceNetMap, NovaPlacementNetwork]}
118         -
119           if:
120           - nova_workers_zero
121           - {}
122           - nova::wsgi::apache_placement::workers: {get_param: NovaWorkers}
123       step_config: |
124         include tripleo::profile::base::nova::placement
125       service_config_settings:
126         keystone:
127           nova::keystone::auth_placement::tenant: 'service'
128           nova::keystone::auth_placement::public_url: {get_param: [EndpointMap, NovaPlacementPublic, uri]}
129           nova::keystone::auth_placement::internal_url: {get_param: [EndpointMap, NovaPlacementInternal, uri]}
130           nova::keystone::auth_placement::admin_url: {get_param: [EndpointMap, NovaPlacementAdmin, uri]}
131           nova::keystone::auth_placement::password: {get_param: NovaPassword}
132           nova::keystone::auth_placement::region: {get_param: KeystoneRegion}
133         mysql:
134           map_merge:
135           - {get_attr: [NovaBase, role_data, service_config_settings, mysql]}
136           - nova::db::mysql_placement::password: {get_param: NovaPassword}
137             nova::db::mysql_placement::user: nova_placement
138             nova::db::mysql_placement::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
139             nova::db::mysql_placement::dbname: nova_placement
140             nova::db::mysql_placement::allowed_hosts:
141               - '%'
142               - "%{hiera('mysql_bind_host')}"
143       upgrade_tasks:
144         - name: Stop nova_placement service (running under httpd)
145           tags: step1
146           service: name=httpd state=stopped
147         # The nova placement API isn't installed in newton images, so install
148         # it on upgrade
149         - name: Install nova-placement packages on upgrade
150           tags: step3
151           yum: name=openstack-nova-placement-api state=latest