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 A hash of policies to configure for Nova API.
68 e.g. { nova-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
73 nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]}
76 # Temporarily disable Nova API deployed in WSGI
77 # https://bugs.launchpad.net/nova/+bug/1661360
81 # ServiceNetMap: {get_param: ServiceNetMap}
82 # DefaultPasswords: {get_param: DefaultPasswords}
83 # EndpointMap: {get_param: EndpointMap}
84 # EnableInternalTLS: {get_param: EnableInternalTLS}
87 type: ./nova-base.yaml
89 ServiceNetMap: {get_param: ServiceNetMap}
90 DefaultPasswords: {get_param: DefaultPasswords}
91 EndpointMap: {get_param: EndpointMap}
95 description: Role data for the Nova API service.
97 service_name: nova_api
98 monitoring_subscription: {get_param: MonitoringSubscriptionNovaApi}
99 logging_source: {get_param: NovaApiLoggingSource}
104 - get_attr: [NovaBase, role_data, config_settings]
105 # Temporarily disable Nova API deployed in WSGI
106 # https://bugs.launchpad.net/nova/+bug/1661360
107 # - get_attr: [ApacheServiceBase, role_data, config_settings]
108 - nova::cron::archive_deleted_rows::hour: '*/12'
109 nova::cron::archive_deleted_rows::destination: '/dev/null'
110 tripleo.nova_api.firewall_rules:
118 nova::keystone::authtoken::project_name: 'service'
119 nova::keystone::authtoken::user_domain_name: 'Default'
120 nova::keystone::authtoken::project_domain_name: 'Default'
121 nova::keystone::authtoken::password: {get_param: NovaPassword}
122 nova::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
123 nova::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
124 nova::api::enabled: true
125 nova::api::default_floating_pool: {get_param: NovaDefaultFloatingPool}
126 nova::api::sync_db_api: true
127 nova::api::enable_proxy_headers_parsing: true
128 nova::api::api_bind_address:
131 "%{hiera('fqdn_$NETWORK')}"
133 $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
134 # Temporarily disable Nova API deployed in WSGI
135 # https://bugs.launchpad.net/nova/+bug/1661360
136 nova_wsgi_enabled: false
137 # nova::api::service_name: 'httpd'
138 # nova::wsgi::apache_api::ssl: {get_param: EnableInternalTLS}
139 # NOTE: bind IP is found in Heat replacing the network name with the local node IP
140 # for the given network; replacement examples (eg. for internal_api):
142 # internal_api_uri -> [IP]
143 # internal_api_subnet - > IP/CIDR
144 # nova::wsgi::apache_api::bind_host: {get_param: [ServiceNetMap, NovaApiNetwork]}
145 # nova::wsgi::apache_api::servername:
148 # "%{hiera('fqdn_$NETWORK')}"
150 # $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
151 nova::api::neutron_metadata_proxy_shared_secret: {get_param: NeutronMetadataProxySharedSecret}
152 nova::api::instance_name_template: {get_param: InstanceNameTemplate}
153 nova_enable_db_purge: {get_param: NovaEnableDBPurge}
154 nova::policy::policies: {get_param: NovaApiPolicies}
159 - nova::api::osapi_compute_workers: {get_param: NovaWorkers}
160 # Temporarily disable Nova API deployed in WSGI
161 # https://bugs.launchpad.net/nova/+bug/1661360
162 # nova::wsgi::apache_api::workers: {get_param: NovaWorkers}
164 include tripleo::profile::base::nova::api
165 service_config_settings:
168 - {get_attr: [NovaBase, role_data, service_config_settings, mysql]}
169 - nova::db::mysql::password: {get_param: NovaPassword}
170 nova::db::mysql::user: nova
171 nova::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
172 nova::db::mysql::dbname: nova
173 nova::db::mysql::allowed_hosts:
175 - "%{hiera('mysql_bind_host')}"
176 nova::db::mysql_api::password: {get_param: NovaPassword}
177 nova::db::mysql_api::user: nova_api
178 nova::db::mysql_api::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
179 nova::db::mysql_api::dbname: nova_api
180 nova::db::mysql_api::allowed_hosts:
182 - "%{hiera('mysql_bind_host')}"
184 nova::keystone::auth::tenant: 'service'
185 nova::keystone::auth::public_url: {get_param: [EndpointMap, NovaPublic, uri]}
186 nova::keystone::auth::internal_url: {get_param: [EndpointMap, NovaInternal, uri]}
187 nova::keystone::auth::admin_url: {get_param: [EndpointMap, NovaAdmin, uri]}
188 nova::keystone::auth::password: {get_param: NovaPassword}
189 nova::keystone::auth::region: {get_param: KeystoneRegion}
190 # Temporarily disable Nova API deployed in WSGI
191 # https://bugs.launchpad.net/nova/+bug/1661360
193 # get_attr: [ApacheServiceBase, role_data, metadata_settings]
195 - name: get bootstrap nodeid
197 command: hiera bootstrap_nodeid
198 register: bootstrap_node
199 - name: set is_bootstrap_node fact
201 set_fact: is_bootstrap_node={{bootstrap_node.stdout == ansible_hostname}}
202 - name: Extra migration for nova tripleo/+bug/1656791
203 tags: step0,pre-upgrade
204 when: is_bootstrap_node
205 command: nova-manage db online_data_migrations
206 - name: Stop and disable nova_api service (pre-upgrade not under httpd)
208 service: name=openstack-nova-api state=stopped enabled=no
209 - name: Create puppet manifest to set transport_url in nova.conf
211 when: is_bootstrap_node
213 dest: /root/nova-api_upgrade_manifest.pp
216 $transport_url = os_transport_url({
217 'transport' => hiera('messaging_service_name', 'rabbit'),
218 'hosts' => any2array(hiera('rabbitmq_node_names', undef)),
219 'port' => sprintf('%s',hiera('nova::rabbit_port', '5672') ),
220 'username' => hiera('nova::rabbit_userid', 'guest'),
221 'password' => hiera('nova::rabbit_password'),
222 'ssl' => sprintf('%s', bool2num(str2bool(hiera('nova::rabbit_use_ssl', '0'))))
224 oslo::messaging::default { 'nova_config':
225 transport_url => $transport_url
227 - name: Run puppet apply to set tranport_url in nova.conf
229 when: is_bootstrap_node
230 command: puppet apply --modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules --detailed-exitcodes /root/nova-api_upgrade_manifest.pp
231 register: puppet_apply_nova_api_upgrade
232 failed_when: puppet_apply_nova_api_upgrade.rc not in [0,2]
233 changed_when: puppet_apply_nova_api_upgrade.rc == 2
234 - name: Setup cell_v2 (map cell0)
236 when: is_bootstrap_node
237 shell: nova-manage cell_v2 map_cell0 --database_connection=$(hiera nova::cell0_database_connection)
238 - name: Setup cell_v2 (create default cell)
240 when: is_bootstrap_node
241 # (owalsh) puppet-nova expects the cell name 'default'
242 # (owalsh) pass the db uri explicitly to avoid https://bugs.launchpad.net/tripleo/+bug/1662344
243 shell: nova-manage cell_v2 create_cell --name='default' --database_connection=$(hiera nova::database_connection)
244 register: nova_api_create_cell
245 failed_when: nova_api_create_cell.rc not in [0,2]
246 changed_when: nova_api_create_cell.rc == 0
247 - name: Setup cell_v2 (sync nova/cell DB)
249 when: is_bootstrap_node
250 command: nova-manage db sync
251 async: {get_param: NovaDbSyncTimeout}
253 - name: Setup cell_v2 (get cell uuid)
255 when: is_bootstrap_node
256 shell: nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}'
257 register: nova_api_cell_uuid
258 - name: Setup cell_v2 (migrate hosts)
260 when: is_bootstrap_node
261 command: nova-manage cell_v2 discover_hosts --cell_uuid {{nova_api_cell_uuid.stdout}} --verbose
262 - name: Setup cell_v2 (migrate instances)
264 when: is_bootstrap_node
265 command: nova-manage cell_v2 map_instances --cell_uuid {{nova_api_cell_uuid.stdout}}
266 - name: Sync nova_api DB
268 command: nova-manage api_db sync
269 when: is_bootstrap_node
270 - name: Online data migration for nova
272 when: is_bootstrap_node
273 command: nova-manage db online_data_migrations