blob: eec97e34f11b48308574ec7a0c1cb75b1361ed6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
- name: ensure script is run as root
assert:
that:
- ansible_effective_user_id == 0
fail_msg: "this playbook must be run as root"
- name: check if system is debian-based
command: dpkg -l
register: dpkg_check
changed_when: false
failed_when: false
- name: fail if not debian-based
fail:
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
|