Merge "N->O upgrade, blanks ipv6 rules before activating it."
[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. The
25       default value results in the configuration being left unset and a
26       system-dependent default will be chosen (usually the number of
27       processors). Please note that this can result in a large number of
28       processes and memory consumption on systems with a large core count. On
29       such systems it is recommended that a non-default value be selected that
30       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
64   # DEPRECATED: the following options are deprecated and are currently maintained
65   # for backwards compatibility. They will be removed in the Ocata cycle.
66   NeutronL3HA:
67     default: ''
68     type: string
69     description: |
70       Whether to enable HA for virtual routers. When not set, L3 HA will be
71       automatically enabled if the number of nodes hosting controller
72       configurations and DVR is disabled. Valid values are 'true' or 'false'
73       This parameter is being deprecated in Newton and is scheduled to be
74       removed in Ocata.  Future releases will enable L3 HA by default if it is
75       appropriate for the deployment type. Alternate mechanisms will be
76       available to override.
77 parameter_groups:
78 - label: deprecated
79   description: |
80    The following parameters are deprecated and will be removed. They should not
81    be relied on for new deployments. If you have concerns regarding deprecated
82    parameters, please contact the TripleO development team on IRC or the
83    OpenStack mailing list.
84   parameters:
85   - NeutronL3HA
86
87 conditions:
88   use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
89
90 resources:
91
92   TLSProxyBase:
93     type: OS::TripleO::Services::TLSProxyBase
94     properties:
95       ServiceNetMap: {get_param: ServiceNetMap}
96       DefaultPasswords: {get_param: DefaultPasswords}
97       EndpointMap: {get_param: EndpointMap}
98       EnableInternalTLS: {get_param: EnableInternalTLS}
99
100   NeutronBase:
101     type: ./neutron-base.yaml
102     properties:
103       ServiceNetMap: {get_param: ServiceNetMap}
104       DefaultPasswords: {get_param: DefaultPasswords}
105       EndpointMap: {get_param: EndpointMap}
106
107 outputs:
108   role_data:
109     description: Role data for the Neutron Server agent service.
110     value:
111       service_name: neutron_api
112       monitoring_subscription: {get_param: MonitoringSubscriptionNeutronServer}
113       logging_source: {get_param: NeutronApiLoggingSource}
114       logging_groups:
115         - neutron
116       config_settings:
117         map_merge:
118           - get_attr: [NeutronBase, role_data, config_settings]
119           - get_attr: [TLSProxyBase, role_data, config_settings]
120           - neutron::server::database_connection:
121               list_join:
122                 - ''
123                 - - {get_param: [EndpointMap, MysqlInternal, protocol]}
124                   - '://neutron:'
125                   - {get_param: NeutronPassword}
126                   - '@'
127                   - {get_param: [EndpointMap, MysqlInternal, host]}
128                   - '/ovs_neutron'
129                   - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
130             neutron::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
131             neutron::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
132             neutron::server::api_workers: {get_param: NeutronWorkers}
133             neutron::server::rpc_workers: {get_param: NeutronWorkers}
134             neutron::server::allow_automatic_l3agent_failover: {get_param: NeutronAllowL3AgentFailover}
135             neutron::server::enable_proxy_headers_parsing: true
136             neutron::keystone::authtoken::password: {get_param: NeutronPassword}
137             neutron::server::notifications::auth_url: { get_param: [ EndpointMap, KeystoneInternal, uri_no_suffix ] }
138             neutron::server::notifications::tenant_name: 'service'
139             neutron::server::notifications::project_name: 'service'
140             neutron::server::notifications::password: {get_param: NovaPassword}
141             neutron::keystone::authtoken::project_name: 'service'
142             neutron::keystone::authtoken::user_domain_name: 'Default'
143             neutron::keystone::authtoken::project_domain_name: 'Default'
144             neutron::server::sync_db: true
145             tripleo.neutron_api.firewall_rules:
146               '114 neutron api':
147                 dport:
148                   - 9696
149                   - 13696
150             neutron::server::router_distributed: {get_param: NeutronEnableDVR}
151             # NOTE: bind IP is found in Heat replacing the network name with the local node IP
152             # for the given network; replacement examples (eg. for internal_api):
153             # internal_api -> IP
154             # internal_api_uri -> [IP]
155             # internal_api_subnet - > IP/CIDR
156             tripleo::profile::base::neutron::server::tls_proxy_bind_ip:
157               get_param: [ServiceNetMap, NeutronApiNetwork]
158             tripleo::profile::base::neutron::server::tls_proxy_fqdn:
159               str_replace:
160                 template:
161                   "%{hiera('fqdn_$NETWORK')}"
162                 params:
163                   $NETWORK: {get_param: [ServiceNetMap, NeutronApiNetwork]}
164             tripleo::profile::base::neutron::server::tls_proxy_port:
165               get_param: [EndpointMap, NeutronInternal, port]
166             # Bind to localhost if internal TLS is enabled, since we put a TLS
167             # proxy in front.
168             neutron::bind_host:
169               if:
170               - use_tls_proxy
171               - 'localhost'
172               - {get_param: [ServiceNetMap, NeutronApiNetwork]}
173             tripleo::profile::base::neutron::server::l3_ha_override: {get_param: NeutronL3HA}
174       step_config: |
175         include tripleo::profile::base::neutron::server
176       service_config_settings:
177         keystone:
178           neutron::keystone::auth::tenant: 'service'
179           neutron::keystone::auth::public_url: {get_param: [EndpointMap, NeutronPublic, uri]}
180           neutron::keystone::auth::internal_url: { get_param: [ EndpointMap, NeutronInternal, uri ] }
181           neutron::keystone::auth::admin_url: { get_param: [ EndpointMap, NeutronAdmin, uri ] }
182           neutron::keystone::auth::password: {get_param: NeutronPassword}
183           neutron::keystone::auth::region: {get_param: KeystoneRegion}
184         mysql:
185           neutron::db::mysql::password: {get_param: NeutronPassword}
186           neutron::db::mysql::user: neutron
187           neutron::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
188           neutron::db::mysql::dbname: ovs_neutron
189           neutron::db::mysql::allowed_hosts:
190             - '%'
191             - "%{hiera('mysql_bind_host')}"
192       upgrade_tasks:
193         - name: Check if neutron_server is deployed
194           command: systemctl is-enabled neutron-server
195           tags: common
196           ignore_errors: True
197           register: neutron_server_enabled
198         - name: "PreUpgrade step0,validation: Check service neutron-server is running"
199           shell: /usr/bin/systemctl show 'neutron-server' --property ActiveState | grep '\bactive\b'
200           when: neutron_server_enabled.rc == 0
201           tags: step0,validation
202         - name: Stop neutron_api service
203           tags: step1
204           when: neutron_server_enabled.rc == 0
205           service: name=neutron-server state=stopped
206       metadata_settings:
207         get_attr: [TLSProxyBase, role_data, metadata_settings]