Skip to content

Commit 75ad000

Browse files
committed
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
1 parent 3b87df0 commit 75ad000

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

ansible/roles/nova/tasks/config.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
when:
3232
- nova_policy.results
3333

34+
- name: Check for vendordata file
35+
stat:
36+
path: "{{ node_custom_config }}/nova/vendordata.json"
37+
delegate_to: localhost
38+
run_once: True
39+
register: vendordata_file
40+
3441
- include_tasks: copy-certs.yml
3542
when:
3643
- kolla_copy_ca_into_containers | bool or nova_enable_tls_backend | bool
@@ -94,3 +101,18 @@
94101
- nova_services["nova-api"].enabled | bool
95102
notify:
96103
- "Restart nova-api container"
104+
105+
- name: Copying over vendordata file
106+
vars:
107+
service: "{{ nova_services['nova-api'] }}"
108+
copy:
109+
src: "{{ vendordata_file.stat.path }}"
110+
dest: "{{ node_config_directory }}/nova-api/vendordata.json"
111+
mode: "0660"
112+
become: True
113+
when:
114+
- vendordata_file.stat.path is defined
115+
- inventory_hostname in groups[service['group']]
116+
- service.enabled | bool
117+
notify:
118+
- "Restart nova-api container"

ansible/roles/nova/templates/nova-api.json.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
"dest": "/etc/nova/certs/nova-key.pem",
3333
"owner": "nova",
3434
"perm": "0600"
35+
}{% endif %}{% if vendordata_file.stat.path is defined %},
36+
{
37+
"source": "{{ container_config_directory }}/vendordata.json",
38+
"dest": "/etc/nova/vendordata.json",
39+
"owner": "nova",
40+
"perm": "0600"
3541
}{% endif %}
3642
],
3743
"permissions": [

ansible/roles/nova/templates/nova.conf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ track_instance_changes = False
3838
[api]
3939
use_forwarded_for = true
4040

41+
{% if vendordata_file.stat.path is defined %}
42+
vendordata_jsonfile_path = /etc/nova/vendordata.json
43+
{% endif %}
44+
4145
# Super conductor
4246
[conductor]
4347
workers = {{ openstack_service_workers }}

doc/source/reference/compute/nova-guide.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ Cells
5656

5757
Information on using Nova Cells V2 to scale out can be found in
5858
:doc:`nova-cells-guide`.
59+
60+
Vendordata
61+
==========
62+
63+
Nova supports passing deployer provided data to instances using a
64+
concept known as Vendordata. If a Vendordata file is located in the
65+
following path within the Kolla configuration, Kolla will
66+
automatically use it when the Nova service is deployed or
67+
reconfigured: ``/etc/kolla/config/nova/vendordata.json``.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Support for configuring a Vendordata file for Nova has been
5+
added. This allows users to pass through arbitrary data to
6+
instances.

0 commit comments

Comments
 (0)