diff --git a/ansible/roles/ironic-enrolment/tasks/node.yml b/ansible/roles/ironic-enrolment/tasks/node.yml index 5bc086b..5b73b0a 100644 --- a/ansible/roles/ironic-enrolment/tasks/node.yml +++ b/ansible/roles/ironic-enrolment/tasks/node.yml @@ -87,10 +87,21 @@ --{{ iface }}-interface {{ node.ironic_config[iface + '_interface'] }} {% endif %} {% endfor %} - {% for key, val in ( - node.ironic_config.properties | default({})).iteritems() %} + {% for key, val in properties.iteritems() %} --property '{{ key }}={{ val }}' {% endfor %} + vars: + properties: "{{ default_properties | combine(custom_properties) }}" + custom_properties: "{{ node.ironic_config.get('properties', {}) }}" + # Although properties are not required for scheduling, the os_ironic module + # adds silly defaults that cause the validation API call to fail, + # preventing deployment. We add them here because the os_ironic module + # uses unusual names (cpus, ram, disk_size) for scheduling properties, + # and doesn't support setting other properties. + default_properties: + cpus: "{{ node.vcpus }}" + memory_mb: "{{ node.memory_mb }}" + local_gb: "{{ node.volumes[0].capacity | size_string_to_gb if node.volumes | length > 0 else 0 }}" - name: Add Ironic node traits command: >- diff --git a/releasenotes/notes/default-properties-a59636e41be05d66.yaml b/releasenotes/notes/default-properties-a59636e41be05d66.yaml new file mode 100644 index 0000000..19359ba --- /dev/null +++ b/releasenotes/notes/default-properties-a59636e41be05d66.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Adds support for setting default properties on ironic nodes. This avoids an + issue where nodes are registered with the standard scheduling properties + all set to 1, causing ironic validation failures. See `story 2004908 + `__ for details.