diff --git a/defaults/main.yml b/defaults/main.yml index 96cd53a1..c31b776a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -406,6 +406,31 @@ nova_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['proces # "compute:create": "" # "compute:create:attach_network": "" +## Resource provider vars +# Optionally specify a set of resource providers that a particular compute node exposes +# See https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html +nova_provider_overrides: [] +# nova_provider_overrides: +# - name: my_provider +# content: +# meta: +# schema_version: '1.0' +# providers: +# - identification: +# name: 'EXAMPLE_RESOURCE_PROVIDER' +# inventories: +# additional: +# - CUSTOM_EXAMPLE_RESOURCE_CLASS: +# total: 100 +# reserved: 0 +# min_unit: 1 +# max_unit: 10 +# step_size: 1 +# allocation_ratio: 1.0 +# traits: +# additional: +# - 'CUSTOM_EXAMPLE_TRAIT' + nova_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" ## libvirtd config options diff --git a/releasenotes/notes/nova-resource-provider-config-files-a7ff9303bba083f9.yaml b/releasenotes/notes/nova-resource-provider-config-files-a7ff9303bba083f9.yaml new file mode 100644 index 00000000..2d9b9f22 --- /dev/null +++ b/releasenotes/notes/nova-resource-provider-config-files-a7ff9303bba083f9.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Support is added to the os_nova ansible role to deploy resource provider + config files to nova compute nodes. This allows automatic configuraion + of resource providers without having to use the openstack API or + command line. diff --git a/tasks/nova_post_install.yml b/tasks/nova_post_install.yml index 67a6e298..211d344a 100644 --- a/tasks/nova_post_install.yml +++ b/tasks/nova_post_install.yml @@ -93,6 +93,22 @@ - nova-config - nova-policy-override +- name: Implement compute host provider.yaml if there are overrides configured + openstack.config_template.config_template: + content: "{{ item.content }}" + dest: "/etc/nova/provider_config/{{ item.name }}.yaml" + owner: "root" + group: "{{ nova_system_group_name }}" + mode: 0640 + config_type: yaml + with_items: + - "{{ nova_provider_overrides }}" + when: + - nova_services['nova-compute']['group'] in group_names + tags: + - nova-config + - nova-provider-override + - name: Remove legacy policy.yaml file file: path: "/etc/nova/policy.yaml" diff --git a/tasks/nova_pre_install.yml b/tasks/nova_pre_install.yml index 783b9f56..9fea883e 100644 --- a/tasks/nova_pre_install.yml +++ b/tasks/nova_pre_install.yml @@ -93,6 +93,9 @@ state: link force: true condition: "{{ nova_install_method == 'source' }}" + - path: "/etc/nova/provider_config" + owner: "root" + mode: "0640" - path: "/etc/sudoers.d" mode: "0750" owner: "root"