From 5f37af71b0ff6bad5704da364fb76a8ea9be840e Mon Sep 17 00:00:00 2001 From: prakhar Date: Thu, 16 Apr 2026 16:39:53 +1000 Subject: [PATCH 1/2] fix: convert network config from Python dict string to YAML dict The config var was defined as a single-quoted Python dict string. Applying | to_json to a string just wraps it in quotes rather than converting it to valid JSON, causing Multus webhook to reject the NetworkAttachmentDefinition with 'configuration string is not in JSON format'. Defining config as a proper YAML dict ensures | to_json produces valid JSON that Multus accepts. --- .../tasks/create_network.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/roles-infra/infra-openshift-cnv-resources/tasks/create_network.yaml b/ansible/roles-infra/infra-openshift-cnv-resources/tasks/create_network.yaml index ad3cd84a92f..2d12884b170 100644 --- a/ansible/roles-infra/infra-openshift-cnv-resources/tasks/create_network.yaml +++ b/ansible/roles-infra/infra-openshift-cnv-resources/tasks/create_network.yaml @@ -10,7 +10,13 @@ spec: config: "{{ config | to_json }}" vars: - config: "{'cniVersion':'0.3.1','type':'ovn-k8s-cni-overlay','topology':'layer2','name': '{{ _network.name }}{{ guid }}', 'netAttachDefName': '{{ openshift_cnv_namespace }}/{{ _network.name }}{{ guid }}', 'mtu': {{ _network.mtu | default(1500) }}}" + config: + cniVersion: "0.3.1" + type: "ovn-k8s-cni-overlay" + topology: "layer2" + name: "{{ _network.name }}{{ guid }}" + netAttachDefName: "{{ openshift_cnv_namespace }}/{{ _network.name }}{{ guid }}" + mtu: "{{ _network.mtu | default(1500) | int }}" register: r_createnetwork until: r_createnetwork is success retries: "{{ openshift_cnv_retries }}" From f1f9bee7488cbd6f109d16e1bf758322066f8582 Mon Sep 17 00:00:00 2001 From: prakhar Date: Thu, 16 Apr 2026 17:09:52 +1000 Subject: [PATCH 2/2] fix: use 'is defined' instead of string boolean in create_inventory local_bastion is a string (VM name). ansible-core 2.18 requires conditionals to return a boolean, not a string. 'local_bastion is defined' correctly checks if the bastion was found without relying on string truthiness. --- .../tasks/create_inventory.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles-infra/infra-openshift-cnv-create-inventory/tasks/create_inventory.yaml b/ansible/roles-infra/infra-openshift-cnv-create-inventory/tasks/create_inventory.yaml index a90d49f8f4b..46b37161120 100644 --- a/ansible/roles-infra/infra-openshift-cnv-create-inventory/tasks/create_inventory.yaml +++ b/ansible/roles-infra/infra-openshift-cnv-create-inventory/tasks/create_inventory.yaml @@ -42,7 +42,7 @@ sessionAffinity: None type: NodePort register: r_expose_bastion - when: local_bastion|default(False) + when: local_bastion is defined until: r_expose_bastion is success retries: "{{ openshift_cnv_retries }}" delay: "{{ openshift_cnv_delay }}"