1 heat_template_version: ocata
4 OpenStack Nova API service configured with Puppet
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.
18 description: Mapping of service endpoint -> protocol. Typically set
19 via parameter_defaults in the resource registry.
23 description: Number of workers for Nova API service.
26 description: The password for the nova service and db account, used by nova-api.
32 description: Keystone region for endpoint
33 NeutronMetadataProxySharedSecret:
34 description: Shared secret to prevent spoofing
38 default: 'instance-%08x'
39 description: Template string to be used to generate instance names
44 Whether to create cron job for purging soft deleted rows in Nova database.
46 MonitoringSubscriptionNovaApi:
47 default: 'overcloud-nova-api'
52 tag: openstack.nova.api
53 path: /var/log/nova/nova-api.log
57 NovaDefaultFloatingPool:
59 description: Default pool for floating IP addresses
63 description: Timeout for Nova db sync
67 nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]}
70 # Temporarily disable Nova API deployed in WSGI
71 # https://bugs.launchpad.net/nova/+bug/1661360
75 # ServiceNetMap: {get_param: ServiceNetMap}
76 # DefaultPasswords: {get_param: DefaultPasswords}
77 # EndpointMap: {get_param: EndpointMap}
78 # EnableInternalTLS: {get_param: EnableInternalTLS}
81 type: ./nova-base.yaml
83 ServiceNetMap: {get_param: ServiceNetMap}
84 DefaultPasswords: {get_param: DefaultPasswords}
85 EndpointMap: {get_param: EndpointMap}
89 description: Role data for the Nova API service.
91 service_name: nova_api
92 monitoring_subscription: {get_param: MonitoringSubscriptionNovaApi}
93 logging_source: {get_param: NovaApiLoggingSource}
98 - get_attr: [NovaBase, role_data, config_settings]
99 # Temporarily disable Nova API deployed in WSGI
100 # https://bugs.launchpad.net/nova/+bug/1661360
101 # - get_attr: [ApacheServiceBase, role_data, config_settings]
102 - nova::cron::archive_deleted_rows::hour: '*/12'
103 nova::cron::archive_deleted_rows::destination: '/dev/null'
104 tripleo.nova_api.firewall_rules:
112 nova::keystone::authtoken::project_name: 'service'
113 nova::keystone::authtoken::user_domain_name: 'Default'
114 nova::keystone::authtoken::project_domain_name: 'Default'
115 nova::keystone::authtoken::password: {get_param: NovaPassword}
116 nova::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
117 nova::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
118 nova::api::enabled: true
119 nova::api::default_floating_pool: {get_param: NovaDefaultFloatingPool}
120 nova::api::sync_db_api: true
121 nova::api::enable_proxy_headers_parsing: true
122 nova::api::api_bind_address:
125 "%{hiera('fqdn_$NETWORK')}"
127 $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
128 # Temporarily disable Nova API deployed in WSGI
129 # https://bugs.launchpad.net/nova/+bug/1661360
130 nova_wsgi_enabled: false
131 # nova::api::service_name: 'httpd'
132 # nova::wsgi::apache_api::ssl: {get_param: EnableInternalTLS}
133 # NOTE: bind IP is found in Heat replacing the network name with the local node IP
134 # for the given network; replacement examples (eg. for internal_api):
136 # internal_api_uri -> [IP]
137 # internal_api_subnet - > IP/CIDR
138 # nova::wsgi::apache_api::bind_host: {get_param: [ServiceNetMap, NovaApiNetwork]}
139 # nova::wsgi::apache_api::servername:
142 # "%{hiera('fqdn_$NETWORK')}"
144 # $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
145 nova::api::neutron_metadata_proxy_shared_secret: {get_param: NeutronMetadataProxySharedSecret}
146 nova::api::instance_name_template: {get_param: InstanceNameTemplate}
147 nova_enable_db_purge: {get_param: NovaEnableDBPurge}
152 - nova::api::osapi_compute_workers: {get_param: NovaWorkers}
153 # Temporarily disable Nova API deployed in WSGI
154 # https://bugs.launchpad.net/nova/+bug/1661360
155 # nova::wsgi::apache_api::workers: {get_param: NovaWorkers}
157 include tripleo::profile::base::nova::api
158 service_config_settings:
161 - {get_attr: [NovaBase, role_data, service_config_settings, mysql]}
162 - nova::db::mysql::password: {get_param: NovaPassword}
163 nova::db::mysql::user: nova
164 nova::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
165 nova::db::mysql::dbname: nova
166 nova::db::mysql::allowed_hosts:
168 - "%{hiera('mysql_bind_host')}"
169 nova::db::mysql_api::password: {get_param: NovaPassword}
170 nova::db::mysql_api::user: nova_api
171 nova::db::mysql_api::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
172 nova::db::mysql_api::dbname: nova_api
173 nova::db::mysql_api::allowed_hosts:
175 - "%{hiera('mysql_bind_host')}"
177 nova::keystone::auth::tenant: 'service'
178 nova::keystone::auth::public_url: {get_param: [EndpointMap, NovaPublic, uri]}
179 nova::keystone::auth::internal_url: {get_param: [EndpointMap, NovaInternal, uri]}
180 nova::keystone::auth::admin_url: {get_param: [EndpointMap, NovaAdmin, uri]}
181 nova::keystone::auth::password: {get_param: NovaPassword}
182 nova::keystone::auth::region: {get_param: KeystoneRegion}
183 # Temporarily disable Nova API deployed in WSGI
184 # https://bugs.launchpad.net/nova/+bug/1661360
186 # get_attr: [ApacheServiceBase, role_data, metadata_settings]
188 - name: get bootstrap nodeid
190 command: hiera bootstrap_nodeid
191 register: bootstrap_node
192 - name: set is_bootstrap_node fact
194 set_fact: is_bootstrap_node={{bootstrap_node.stdout == ansible_hostname}}
195 - name: Extra migration for nova tripleo/+bug/1656791
196 tags: step0,pre-upgrade
197 when: is_bootstrap_node
198 command: nova-manage db online_data_migrations
199 - name: Stop and disable nova_api service (pre-upgrade not under httpd)
201 service: name=openstack-nova-api state=stopped enabled=no
202 - name: Create puppet manifest to set transport_url in nova.conf
204 when: is_bootstrap_node
206 dest: /root/nova-api_upgrade_manifest.pp
209 $transport_url = os_transport_url({
210 'transport' => hiera('messaging_service_name', 'rabbit'),
211 'hosts' => any2array(hiera('rabbitmq_node_names', undef)),
212 'port' => sprintf('%s',hiera('nova::rabbit_port', '5672') ),
213 'username' => hiera('nova::rabbit_userid', 'guest'),
214 'password' => hiera('nova::rabbit_password'),
215 'ssl' => sprintf('%s', bool2num(str2bool(hiera('nova::rabbit_use_ssl', '0'))))
217 oslo::messaging::default { 'nova_config':
218 transport_url => $transport_url
220 - name: Run puppet apply to set tranport_url in nova.conf
222 when: is_bootstrap_node
223 command: puppet apply --detailed-exitcodes /root/nova-api_upgrade_manifest.pp
224 register: puppet_apply_nova_api_upgrade
225 failed_when: puppet_apply_nova_api_upgrade.rc not in [0,2]
226 changed_when: puppet_apply_nova_api_upgrade.rc == 2
227 - name: Setup cell_v2 (map cell0)
229 when: is_bootstrap_node
230 shell: nova-manage cell_v2 map_cell0 --database_connection=$(hiera nova::cell0_database_connection)
231 - name: Setup cell_v2 (create default cell)
233 when: is_bootstrap_node
234 # (owalsh) puppet-nova expects the cell name 'default'
235 # (owalsh) pass the db uri explicitly to avoid https://bugs.launchpad.net/tripleo/+bug/1662344
236 shell: nova-manage cell_v2 create_cell --name='default' --database_connection=$(hiera nova::database_connection)
237 register: nova_api_create_cell
238 failed_when: nova_api_create_cell.rc not in [0,2]
239 changed_when: nova_api_create_cell.rc == 0
240 - name: Setup cell_v2 (sync nova/cell DB)
242 when: is_bootstrap_node
243 command: nova-manage db sync
244 async: {get_param: NovaDbSyncTimeout}
246 - name: Setup cell_v2 (get cell uuid)
248 when: is_bootstrap_node
249 shell: nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}'
250 register: nova_api_cell_uuid
251 - name: Setup cell_v2 (migrate hosts)
253 when: is_bootstrap_node
254 command: nova-manage cell_v2 discover_hosts --cell_uuid {{nova_api_cell_uuid.stdout}} --verbose
255 - name: Setup cell_v2 (migrate instances)
257 when: is_bootstrap_node
258 command: nova-manage cell_v2 map_instances --cell_uuid {{nova_api_cell_uuid.stdout}}
259 - name: Sync nova_api DB
261 command: nova-manage api_db sync
262 when: is_bootstrap_node
263 - name: Online data migration for nova
265 when: is_bootstrap_node
266 command: nova-manage db online_data_migrations