diff --git a/ansible/roles/nova-cell/tasks/config.yml b/ansible/roles/nova-cell/tasks/config.yml index 191634b863..d4410b51e9 100644 --- a/ansible/roles/nova-cell/tasks/config.yml +++ b/ansible/roles/nova-cell/tasks/config.yml @@ -40,6 +40,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 + - name: Copying over config.json files for services become: true template: @@ -201,3 +214,21 @@ with_dict: "{{ nova_cell_services }}" notify: - "Restart {{ item.key }} container" + +- name: Copying over vendordata file to containers + vars: + service: "{{ nova_cell_services[item] }}" + copy: + src: "{{ vendordata_file_path }}" + dest: "{{ node_config_directory }}/{{ item }}/vendordata.json" + mode: "0660" + become: True + when: + - vendordata_file_path is defined + - inventory_hostname in groups[service.group] + - service.enabled | bool + notify: + - "Restart {{ item }} container" + with_items: + - nova-compute + - nova-compute-ironic diff --git a/ansible/roles/nova-cell/templates/nova-compute-ironic.json.j2 b/ansible/roles/nova-cell/templates/nova-compute-ironic.json.j2 index d41811fc70..1c2fb31d98 100644 --- a/ansible/roles/nova-cell/templates/nova-compute-ironic.json.j2 +++ b/ansible/roles/nova-cell/templates/nova-compute-ironic.json.j2 @@ -12,6 +12,12 @@ "dest": "/etc/nova/{{ nova_policy_file }}", "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": [ diff --git a/ansible/roles/nova-cell/templates/nova-compute.json.j2 b/ansible/roles/nova-cell/templates/nova-compute.json.j2 index cf27fba3bd..a6b5bc554c 100644 --- a/ansible/roles/nova-cell/templates/nova-compute.json.j2 +++ b/ansible/roles/nova-cell/templates/nova-compute.json.j2 @@ -67,6 +67,12 @@ "dest": "/etc/nova/provider_config/provider_config.yaml", "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": [ diff --git a/ansible/roles/nova-cell/templates/nova.conf.j2 b/ansible/roles/nova-cell/templates/nova.conf.j2 index 41cd9a1046..252a4e2054 100644 --- a/ansible/roles/nova-cell/templates/nova.conf.j2 +++ b/ansible/roles/nova-cell/templates/nova.conf.j2 @@ -36,6 +36,11 @@ compute_monitors=nova.compute.monitors.cpu.virt_driver transport_url = {{ nova_cell_rpc_transport_url }} +{% if vendordata_file_path is defined and (service_name == 'nova-compute' or service_name == 'nova-compute-ironic') %} +[api] +vendordata_jsonfile_path = /etc/nova/vendordata.json +{% endif %} + [conductor] workers = {{ nova_cell_conductor_workers }} diff --git a/releasenotes/notes/bug-2049607-fb79ea2960b91bde.yaml b/releasenotes/notes/bug-2049607-fb79ea2960b91bde.yaml new file mode 100644 index 0000000000..13a353d55a --- /dev/null +++ b/releasenotes/notes/bug-2049607-fb79ea2960b91bde.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes configuration of nova-compute and nova-compute-ironic, + that will enable exposing vendordata over configdrive. + `LP#2049607 `__