summaryrefslogtreecommitdiffstats
path: root/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/infra_create_vms/tasks/create_interfaces.yml')
-rw-r--r--ansible/roles/infra_create_vms/tasks/create_interfaces.yml10
1 files changed, 10 insertions, 0 deletions
diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
index 124421b56..34bfd1b71 100644
--- a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
+++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
@@ -24,6 +24,16 @@
addresses:
- {{ interface_item.ip }}/{{ interface_item.netmask }}
+- name: Add default gateway
+ blockinfile:
+ path: "{{ network_config }}"
+ insertafter: "{{ interface_item.ip }}"
+ marker: "MARKER"
+ block: |2
+ gateway4: {{ default_bridge.host_ip }}
+ when:
+ - default_bridge is defined
+ - default_bridge.name == interface_item.network
- name: Remove the marker introduced in network-data
lineinfile: