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::password: {get_param: NovaPassword}
114 nova::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri] }
115 nova::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
116 nova::api::enabled: true
117 nova::api::default_floating_pool: {get_param: NovaDefaultFloatingPool}
118 nova::api::sync_db_api: true
119 nova::api::enable_proxy_headers_parsing: true
120 nova::api::api_bind_address:
123 "%{hiera('fqdn_$NETWORK')}"
125 $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
126 # Temporarily disable Nova API deployed in WSGI
127 # https://bugs.launchpad.net/nova/+bug/1661360
128 nova_wsgi_enabled: false
129 # nova::api::service_name: 'httpd'
130 # nova::wsgi::apache_api::ssl: {get_param: EnableInternalTLS}
131 # NOTE: bind IP is found in Heat replacing the network name with the local node IP
132 # for the given network; replacement examples (eg. for internal_api):
134 # internal_api_uri -> [IP]
135 # internal_api_subnet - > IP/CIDR
136 # nova::wsgi::apache_api::bind_host: {get_param: [ServiceNetMap, NovaApiNetwork]}
137 # nova::wsgi::apache_api::servername:
140 # "%{hiera('fqdn_$NETWORK')}"
142 # $NETWORK: {get_param: [ServiceNetMap, NovaApiNetwork]}
143 nova::api::neutron_metadata_proxy_shared_secret: {get_param: NeutronMetadataProxySharedSecret}
144 nova::api::instance_name_template: {get_param: InstanceNameTemplate}
145 nova_enable_db_purge: {get_param: NovaEnableDBPurge}
150 - nova::api::osapi_compute_workers: {get_param: NovaWorkers}
151 # Temporarily disable Nova API deployed in WSGI
152 # https://bugs.launchpad.net/nova/+bug/1661360
153 # nova::wsgi::apache_api::workers: {get_param: NovaWorkers}
155 include tripleo::profile::base::nova::api
156 service_config_settings:
159 - {get_attr: [NovaBase, role_data, service_config_settings, mysql]}
160 - nova::db::mysql::password: {get_param: NovaPassword}
161 nova::db::mysql::user: nova
162 nova::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
163 nova::db::mysql::dbname: nova
164 nova::db::mysql::allowed_hosts:
166 - "%{hiera('mysql_bind_host')}"
167 nova::db::mysql_api::password: {get_param: NovaPassword}
168 nova::db::mysql_api::user: nova_api
169 nova::db::mysql_api::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
170 nova::db::mysql_api::dbname: nova_api
171 nova::db::mysql_api::allowed_hosts:
173 - "%{hiera('mysql_bind_host')}"
175 nova::keystone::auth::tenant: 'service'
176 nova::keystone::auth::public_url: {get_param: [EndpointMap, NovaPublic, uri]}
177 nova::keystone::auth::internal_url: {get_param: [EndpointMap, NovaInternal, uri]}
178 nova::keystone::auth::admin_url: {get_param: [EndpointMap, NovaAdmin, uri]}
179 nova::keystone::auth::password: {get_param: NovaPassword}
180 nova::keystone::auth::region: {get_param: KeystoneRegion}
181 # Temporarily disable Nova API deployed in WSGI
182 # https://bugs.launchpad.net/nova/+bug/1661360
184 # get_attr: [ApacheServiceBase, role_data, metadata_settings]
186 - name: get bootstrap nodeid
188 command: hiera bootstrap_nodeid
189 register: bootstrap_node
190 - name: set is_bootstrap_node fact
192 set_fact: is_bootstrap_node={{bootstrap_node.stdout == ansible_hostname}}
193 - name: Extra migration for nova tripleo/+bug/1656791
194 tags: step0,pre-upgrade
195 when: is_bootstrap_node
196 command: nova-manage db online_data_migrations
197 - name: Stop and disable nova_api service (pre-upgrade not under httpd)
199 service: name=openstack-nova-api state=stopped enabled=no
200 - name: Create puppet manifest to set transport_url in nova.conf
202 when: is_bootstrap_node
204 dest: /root/nova-api_upgrade_manifest.pp
207 $transport_url = os_transport_url({
208 'transport' => hiera('messaging_service_name', 'rabbit'),
209 'hosts' => any2array(hiera('rabbitmq_node_names', undef)),
210 'port' => sprintf('%s',hiera('nova::rabbit_port', '5672') ),
211 'username' => hiera('nova::rabbit_userid', 'guest'),
212 'password' => hiera('nova::rabbit_password'),
213 'ssl' => sprintf('%s', bool2num(str2bool(hiera('nova::rabbit_use_ssl', '0'))))
215 oslo::messaging::default { 'nova_config':
216 transport_url => $transport_url
218 - name: Run puppet apply to set tranport_url in nova.conf
220 when: is_bootstrap_node
221 command: puppet apply --detailed-exitcodes /root/nova-api_upgrade_manifest.pp
222 register: puppet_apply_nova_api_upgrade
223 failed_when: puppet_apply_nova_api_upgrade.rc not in [0,2]
224 changed_when: puppet_apply_nova_api_upgrade.rc == 2
225 - name: Setup cell_v2 (map cell0)
227 when: is_bootstrap_node
228 command: nova-manage cell_v2 map_cell0
229 - name: Setup cell_v2 (create default cell)
231 when: is_bootstrap_node
232 # (owalsh) puppet-nova expects the cell name 'default'
233 # (owalsh) pass the db uri explicitly to avoid https://bugs.launchpad.net/tripleo/+bug/1662344
234 shell: nova-manage cell_v2 create_cell --name='default' --database_connection=$(hiera nova::database_connection)
235 register: nova_api_create_cell
236 failed_when: nova_api_create_cell.rc not in [0,2]
237 changed_when: nova_api_create_cell.rc == 0
238 - name: Setup cell_v2 (sync nova/cell DB)
240 when: is_bootstrap_node
241 command: nova-manage db sync
242 async: {get_param: NovaDbSyncTimeout}
244 - name: Setup cell_v2 (migrate hosts)
246 when: is_bootstrap_node
247 command: nova-manage cell_v2 map_cell_and_hosts
248 - name: Setup cell_v2 (get cell uuid)
250 when: is_bootstrap_node
251 shell: nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}'
252 register: nova_api_cell_uuid
253 - name: Setup cell_v2 (migrate instances)
255 when: is_bootstrap_node
256 command: nova-manage cell_v2 map_instances --cell_uuid {{nova_api_cell_uuid.stdout}}
257 - name: Sync nova_api DB
259 command: nova-manage api_db sync
260 when: is_bootstrap_node
261 - name: Online data migration for nova
263 when: is_bootstrap_node
264 command: nova-manage db online_data_migrations