Skip to content

Commit 854c738

Browse files
committed
[libvirt_manager] Quote all IP addresses in YAML generation
Add quotes to all network-v4, range-v4, ip-v4, network-v6, range-v6, and ip-v6 to prevent YAML parsing errors with IP addresses containing colons.
1 parent 1812979 commit 854c738

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

roles/libvirt_manager/tasks/generate_networking_data.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
{{ _lnet_data.name | replace('cifmw_', '') }}:
184184
{% if _lnet_data.ranges[0].start_v4 is defined and _lnet_data.ranges[0].start_v4 %}
185185
{% set net_4 = _lnet_data.ranges[0].start_v4 | ansible.utils.ipsubnet(_lnet_data.ranges[0].prefix_length_v4) %}
186-
network-v4: {{ net_4}}
186+
network-v4: '{{ net_4 }}'
187187
{% endif %}
188188
{% if _lnet_data.ranges[0].start_v6 is defined and _lnet_data.ranges[0].start_v6 %}
189189
{% set net_6 = _lnet_data.ranges[0].start_v6 | ansible.utils.ipsubnet(_lnet_data.ranges[0].prefix_length_v6) %}
@@ -202,7 +202,7 @@
202202
{% if cifmw_networking_definition['group-templates'][_gr ~ 's']['network-template'] is undefined %}
203203
{% if net_4 is defined %}
204204
range-v4:
205-
start: {{ net_4 | ansible.utils.nthhost(ns.ip_start | int ) }}
205+
start: '{{ net_4 | ansible.utils.nthhost(ns.ip_start | int ) }}'
206206
length: {{ _cifmw_libvirt_manager_layout.vms[group].amount | default(1) }}
207207
{% endif %}
208208
{% if net_6 is defined %}
@@ -220,7 +220,7 @@
220220
{{ cifmw_libvirt_manager_pub_net }}:
221221
{% if net_4 is defined and cifmw_networking_definition['group-templates']['baremetals']['network-template'] is undefined %}
222222
range-v4:
223-
start: {{ net_4 | ansible.utils.nthhost(ns.ip_start) }}
223+
start: '{{ net_4 | ansible.utils.nthhost(ns.ip_start) }}'
224224
length: {{ cifmw_baremetal_hosts | length }}
225225
{% endif %}
226226
{% if net_6 is defined and cifmw_networking_definition['group-templates']['baremetals']['network-template'] is undefined %}
@@ -235,7 +235,7 @@
235235
networks:
236236
{{ _lnet_data.name | replace('cifmw_', '') }}:
237237
{% if net_4 is defined %}
238-
ip-v4: "{{ net_4 | ansible.utils.nthhost(9) }}"
238+
ip-v4: '{{ net_4 | ansible.utils.nthhost(9) }}'
239239
{% endif %}
240240
{% if net_6 is defined %}
241241
ip-v6: '{{ net_6 | ansible.utils.nthhost(9) }}'

0 commit comments

Comments
 (0)