Merge "Add parameter Ec2ApiExternalNetwork for VPCs"
[apex-tripleo-heat-templates.git] / puppet / services / neutron-api.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack Neutron Server 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   EndpointMap:
17     default: {}
18     description: Mapping of service endpoint -> protocol. Typically set
19                  via parameter_defaults in the resource registry.
20     type: json
21   NeutronWorkers:
22     default: ''
23     description: |
24       Sets the number of API and RPC workers for the Neutron service.
25       The default value results in the configuration being left unset
26       and a system-dependent default will be chosen (usually the number
27       of processors). Please note that this can result in a large number
28       of processes and memory consumption on systems with a large core
29       count. On such systems it is recommended that a non-default value
30       be selected that matches the load requirements.
31     type: string
32   NeutronPassword:
33     description: The password for the neutron service and db account, used by neutron agents.
34     type: string
35     hidden: true
36   NeutronAllowL3AgentFailover:
37     default: 'True'
38     description: Allow automatic l3-agent failover
39     type: string
40   NovaPassword:
41     description: The password for the nova service and db account, used by nova-api.
42     type: string
43     hidden: true
44   NeutronEnableDVR:
45     description: Enable Neutron DVR.
46     default: false
47     type: boolean
48   KeystoneRegion:
49     type: string
50     default: 'regionOne'
51     description: Keystone region for endpoint
52   MonitoringSubscriptionNeutronServer:
53     default: 'overcloud-neutron-server'
54     type: string
55   NeutronApiLoggingSource:
56     type: json
57     default:
58       tag: openstack.neutron.api
59       path: /var/log/neutron/server.log
60   EnableInternalTLS:
61     type: boolean
62     default: false
63   NeutronApiPolicies:
64     description: |
65       A hash of policies to configure for Neutron API.
66       e.g. { neutron-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
67     default: {}
68     type: json
69
70   # DEPRECATED: the following options are deprecated and are currently maintained
71   # for backwards compatibility. They will be removed in the Ocata cycle.
72   NeutronL3HA:
73     default: ''
74     type: string
75     description: |
76       Whether to enable HA for virtual routers. When not set, L3 HA will be
77       automatically enabled if the number of nodes hosting controller
78       configurations and DVR is disabled. Valid values are 'true' or 'false'
79       This parameter is being deprecated in Newton and is scheduled to be
80       removed in Ocata.  Future releases will enable L3 HA by default if it is
81       appropriate for the deployment type. Alternate mechanisms will be
82       available to override.
83 parameter_groups:
84 - label: deprecated
85   description: |
86    The following parameters are deprecated and will be removed. They should not
87    be relied on for new deployments. If you have concerns regarding deprecated
88    parameters, please contact the TripleO development team on IRC or the
89    OpenStack mailing list.
90   parameters:
91   - NeutronL3HA
92
93 conditions:
94   use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
95   neutron_workers_unset: {equals : [{get_param: NeutronWorkers}, '']}
96
97 resources:
98
99   TLSProxyBase:
100     type: OS::TripleO::Services::TLSProxyBase
101     properties:
102       ServiceNetMap: {get_param: ServiceNetMap}
103       DefaultPasswords: {get_param: DefaultPasswords}
104       EndpointMap: {get_param: EndpointMap}
105       EnableInternalTLS: {get_param: EnableInternalTLS}
106
107   NeutronBase:
108     type: ./neutron-base.yaml
109     properties:
110       ServiceNetMap: {get_param: ServiceNetMap}
111       DefaultPasswords: {get_param: DefaultPasswords}
112       EndpointMap: {get_param: EndpointMap}
113
114 outputs:
115   role_data:
116     description: Role data for the Neutron Server agent service.
117     value:
118       service_name: neutron_api
119       monitoring_subscription: {get_param: MonitoringSubscriptionNeutronServer}
120       logging_source: {get_param: NeutronApiLoggingSource}
121       logging_groups:
122         - neutron
123       config_settings:
124         map_merge:
125           - get_attr: [NeutronBase, role_data, config_settings]
126           - get_attr: [TLSProxyBase, role_data, config_settings]
127           - neutron::server::database_connection:
128               list_join:
129                 - ''
130                 - - {get_param: [EndpointMap, MysqlInternal, protocol]}
131                   - '://neutron:'
132                   - {get_param: NeutronPassword}
133                   - '@'
134                   - {get_param: [EndpointMap, MysqlInternal, host]}
135                   - '/ovs_neutron'
136                   - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
137             neutron::policy::policies: {get_param: NeutronApiPolicies}
138             neutron::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
139             neutron::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
140             neutron::server::allow_automatic_l3agent_failover: {get_param: NeutronAllowL3AgentFailover}
141             neutron::server::enable_proxy_headers_parsing: true
142             neutron::keystone::authtoken::password: {get_param: NeutronPassword}
143             neutron::server::notifications::auth_url: { get_param: [ EndpointMap, KeystoneInternal, uri_no_suffix ] }
144             neutron::server::notifications::tenant_name: 'service'
145             neutron::server::notifications::project_name: 'service'
146             neutron::server::notifications::password: {get_param: NovaPassword}
147             neutron::keystone::authtoken::project_name: 'service'
148             neutron::keystone::authtoken::user_domain_name: 'Default'
149             neutron::keystone::authtoken::project_domain_name: 'Default'
150             neutron::server::sync_db: true
151             tripleo.neutron_api.firewall_rules:
152               '114 neutron api':
153                 dport:
154                   - 9696
155                   - 13696
156             neutron::server::router_distributed: {get_param: NeutronEnableDVR}
157             # NOTE: bind IP is found in Heat replacing the network name with the local node IP
158             # for the given network; replacement examples (eg. for internal_api):
159             # internal_api -> IP
160             # internal_api_uri -> [IP]
161             # internal_api_subnet - > IP/CIDR
162             tripleo::profile::base::neutron::server::tls_proxy_bind_ip:
163               get_param: [ServiceNetMap, NeutronApiNetwork]
164             tripleo::profile::base::neutron::server::tls_proxy_fqdn:
165               str_replace:
166                 template:
167                   "%{hiera('fqdn_$NETWORK')}"
168                 params:
169                   $NETWORK: {get_param: [ServiceNetMap, NeutronApiNetwork]}
170             tripleo::profile::base::neutron::server::tls_proxy_port:
171               get_param: [EndpointMap, NeutronInternal, port]
172             # Bind to localhost if internal TLS is enabled, since we put a TLS
173             # proxy in front.
174             neutron::bind_host:
175               if:
176               - use_tls_proxy
177               - 'localhost'
178               - {get_param: [ServiceNetMap, NeutronApiNetwork]}
179             tripleo::profile::base::neutron::server::l3_ha_override: {get_param: NeutronL3HA}
180           -
181             if:
182             - neutron_workers_unset
183             - {}
184             - neutron::server::api_workers: {get_param: NeutronWorkers}
185               neutron::server::rpc_workers: {get_param: NeutronWorkers}
186       step_config: |
187         include tripleo::profile::base::neutron::server
188       service_config_settings:
189         keystone:
190           neutron::keystone::auth::tenant: 'service'
191           neutron::keystone::auth::public_url: {get_param: [EndpointMap, NeutronPublic, uri]}
192           neutron::keystone::auth::internal_url: { get_param: [ EndpointMap, NeutronInternal, uri ] }
193           neutron::keystone::auth::admin_url: { get_param: [ EndpointMap, NeutronAdmin, uri ] }
194           neutron::keystone::auth::password: {get_param: NeutronPassword}
195           neutron::keystone::auth::region: {get_param: KeystoneRegion}
196         mysql:
197           neutron::db::mysql::password: {get_param: NeutronPassword}
198           neutron::db::mysql::user: neutron
199           neutron::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
200           neutron::db::mysql::dbname: ovs_neutron
201           neutron::db::mysql::allowed_hosts:
202             - '%'
203             - "%{hiera('mysql_bind_host')}"
204       upgrade_tasks:
205         - name: Check if neutron_server is deployed
206           command: systemctl is-enabled neutron-server
207           tags: common
208           ignore_errors: True
209           register: neutron_server_enabled
210         - name: "PreUpgrade step0,validation: Check service neutron-server is running"
211           shell: /usr/bin/systemctl show 'neutron-server' --property ActiveState | grep '\bactive\b'
212           when: neutron_server_enabled.rc == 0
213           tags: step0,validation
214         - name: Stop neutron_api service
215           tags: step1
216           when: neutron_server_enabled.rc == 0
217           service: name=neutron-server state=stopped
218       metadata_settings:
219         get_attr: [TLSProxyBase, role_data, metadata_settings]