Support copying static Vendordata file into Nova API container

Nova provides a mechanism to set static vendordata via a file [1].
This patch provides support in Kolla Ansible for using this
feature.

Arguably this could be part of a generic mechansim for copying
arbitrary config, but:

- It's not clear if there is anything else that would take
  advantage of this
- One size might not fit all

[1] https://docs.openstack.org/nova/latest/configuration/config.html#api.vendordata_jsonfile_path

Change-Id: Id420376d96d0c40415c369ae8dd36e845a781820
This commit is contained in:
Doug Szumski 2021-10-04 17:00:56 +02:00
parent e80b877d26
commit 9af42fcebc
5 changed files with 53 additions and 0 deletions

View File

@ -31,6 +31,19 @@
when:
- nova_policy.results
- name: Check for vendordata file
stat:
path: "{{ node_custom_config }}/nova/vendordata.json"
delegate_to: localhost
run_once: True
register: vendordata_file
- name: Set vendordata file path
set_fact:
vendordata_file_path: "{{ vendordata_file.stat.path }}"
when:
- vendordata_file.stat.exists
- include_tasks: copy-certs.yml
when:
- kolla_copy_ca_into_containers | bool or nova_enable_tls_backend | bool
@ -94,3 +107,18 @@
- nova_services["nova-api"].enabled | bool
notify:
- "Restart nova-api container"
- name: Copying over vendordata file
vars:
service: "{{ nova_services['nova-api'] }}"
copy:
src: "{{ vendordata_file_path }}"
dest: "{{ node_config_directory }}/nova-api/vendordata.json"
mode: "0660"
become: True
when:
- vendordata_file_path is defined
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- "Restart nova-api container"

View File

@ -32,6 +32,12 @@
"dest": "/etc/nova/certs/nova-key.pem",
"owner": "nova",
"perm": "0600"
}{% endif %}{% if vendordata_file_path is defined %},
{
"source": "{{ container_config_directory }}/vendordata.json",
"dest": "/etc/nova/vendordata.json",
"owner": "nova",
"perm": "0600"
}{% endif %}
],
"permissions": [

View File

@ -41,6 +41,10 @@ track_instance_changes = False
[api]
use_forwarded_for = true
{% if vendordata_file_path is defined %}
vendordata_jsonfile_path = /etc/nova/vendordata.json
{% endif %}
# Super conductor
[conductor]
workers = {{ openstack_service_workers }}

View File

@ -56,3 +56,12 @@ Cells
Information on using Nova Cells V2 to scale out can be found in
:doc:`nova-cells-guide`.
Vendordata
==========
Nova supports passing deployer provided data to instances using a
concept known as Vendordata. If a Vendordata file is located in the
following path within the Kolla configuration, Kolla will
automatically use it when the Nova service is deployed or
reconfigured: ``/etc/kolla/config/nova/vendordata.json``.

View File

@ -0,0 +1,6 @@
---
features:
- |
Support for configuring a Vendordata file for Nova has been
added. This allows users to pass through arbitrary data to
instances.