CORD-202 added validation checks to IP/network variables
Change-Id: I83b20338bd052e192d4cfb79a14bf367ca41d9ff
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index 4036daf..8671725 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -7,6 +7,14 @@
tags:
- interface_config
+- name: Verify Network Bits on Network Specifications
+ fail: msg="Network specification '{{ item }}' must include network bits"
+ when: "item != 'dhcp' and item != 'manual' and item | match('^([0-9]{1,3}.){3}[0-9]{1,3}$')"
+ with_items:
+ - "{{ compute_node.addresses.fabric }}"
+ - "{{ compute_node.addresses.management }}"
+ - "{{ compute_node.addresses.external }}"
+
- name: Applications
become: yes
apt: name={{ item }} state=present force=yes
diff --git a/roles/maas/tasks/main.yml b/roles/maas/tasks/main.yml
index 024ef0d..e75d22f 100644
--- a/roles/maas/tasks/main.yml
+++ b/roles/maas/tasks/main.yml
@@ -1,4 +1,12 @@
---
+- name: Verify Network Bits on Network Specifications
+ fail: msg="Network specification '{{ item }}' must include network bits"
+ when: "item | match('^([0-9]{1,3}.){3}[0-9]{1,3}$')"
+ with_items:
+ - "{{ networks.management }}"
+ - "{{ networks.bridge }}"
+ - "{{ networks.fabric }}"
+
- name: Ensure Management Bridge Interface
become: yes
command: ifconfig mgmtbr