diff options
author | heqnx <root@heqnx.com> | 2025-06-24 21:42:08 +0300 |
---|---|---|
committer | heqnx <root@heqnx.com> | 2025-06-24 21:42:08 +0300 |
commit | 03c6f39c9680fc600fec59be5eeacd62c1787f1d (patch) | |
tree | 705ccc630414be77c219df3b8e89208edde980a0 /tasks/preflight.yaml | |
parent | 23f9a880ae74bb195a2aa95bdf3c36986005983d (diff) | |
download | ansible-pve-host-03c6f39c9680fc600fec59be5eeacd62c1787f1d.tar.gz ansible-pve-host-03c6f39c9680fc600fec59be5eeacd62c1787f1d.zip |
added validation for ips, cidrs and ports
Diffstat (limited to 'tasks/preflight.yaml')
-rw-r--r-- | tasks/preflight.yaml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tasks/preflight.yaml b/tasks/preflight.yaml index 6c67ae7..eec97e3 100644 --- a/tasks/preflight.yaml +++ b/tasks/preflight.yaml @@ -15,3 +15,23 @@ msg: "distribution not Debian-based" when: dpkg_check.rc != 0 + +- name: check nat_subnet format + fail: + msg: "nat_subnet must be in CIDR format, e.g., 10.10.10.0/24" + when: nat_subnet is not match("^(\\d{1,3}\\.){3}\\d{1,3}/\\d{1,2}$") + +- name: check nat_bridge_ip is valid ip + fail: + msg: "nat_bridge_ip must be a valid IPv4 address" + when: nat_bridge_ip is not match("^(\\d{1,3}\\.){3}\\d{1,3}$") + +- name: check wg_subnet format + fail: + msg: "wg_subnet must be in CIDR format, e.g., 10.13.37.0/24" + when: wg_subnet is not match("^(\\d{1,3}\\.){3}\\d{1,3}/\\d{1,2}$") + +- name: check wg_port is between 1024 and 65535 + fail: + msg: "wg_port must be a number between 1024 and 65535" + when: wg_port | int < 1024 or wg_port | int > 65535 |