From 218724412be2da103fcdb96ba46fc9d0147bfb4a Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 29 Jan 2024 23:52:45 +0100 Subject: [PATCH] Allow to extend default ironic_driver_types This patch implements extra variable that allows to define extra types for ironic without need to fully override the existing ones. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-os_tempest/+/907180 Change-Id: Ic35dbeae949ba4425a0e352e51de64122b7c13d5 --- defaults/main.yml | 3 +++ .../notes/ironic_user_driver_types-0572dc857f534b92.yaml | 6 ++++++ vars/main.yml | 5 +++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/ironic_user_driver_types-0572dc857f534b92.yaml diff --git a/defaults/main.yml b/defaults/main.yml index a83059eb..08334df0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -363,6 +363,9 @@ ironic_drivers_enabled: - agent_ipmitool - pxe_ipmitool +# extra driver types defined by user +ironic_user_driver_types: {} + ironic_inspector_developer_mode: false ironic_inspector_venv_python_executable: "{{ openstack_venv_python_executable | default('python2') }}" diff --git a/releasenotes/notes/ironic_user_driver_types-0572dc857f534b92.yaml b/releasenotes/notes/ironic_user_driver_types-0572dc857f534b92.yaml new file mode 100644 index 00000000..3ba0a435 --- /dev/null +++ b/releasenotes/notes/ironic_user_driver_types-0572dc857f534b92.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added variable ``ironic_user_driver_types`` that allow to extend + the default ``ironic_driver_types`` as well as override existing + default records. diff --git a/vars/main.yml b/vars/main.yml index 468e54f9..8e99d559 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -332,9 +332,10 @@ filtered_ironic_drivers: |- {% else %} {% set concat_drivers = [] %} {% endif %} + {% set _driver_types = ironic_driver_types | combine(ironic_user_driver_types, recursive=True) %} {% for driver in ironic_drivers_enabled %} - {% if driver in ironic_driver_types.keys() %} - {% set _ = concat_drivers.append(ironic_driver_types[driver]) %} + {% if driver in _driver_types.keys() %} + {% set _ = concat_drivers.append(_driver_types[driver]) %} {% endif %} {% endfor %} {{ concat_drivers }}