fix(pb): makes hostname validation strict enough
This commit was merged in pull request #37.
This commit is contained in:
@@ -43,8 +43,14 @@
|
|||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: |
|
msg: |
|
||||||
Invalid hostname: "{{ lxc_hostname }}"
|
Invalid hostname: "{{ lxc_hostname }}"
|
||||||
Hostname may only contain letters (a-z, A-Z), numbers (0-9), and hyphens (-).
|
Hostname must:
|
||||||
when: not lxc_hostname is regex('^[a-zA-Z0-9-]+$')
|
- contain only letters (a-z, A-Z), digits (0-9), hyphens (-), and dots (.)
|
||||||
|
- not start or end with a hyphen or dot
|
||||||
|
- have each label between 1 and 63 characters
|
||||||
|
- not exceed 253 characters in total
|
||||||
|
when: >
|
||||||
|
lxc_hostname | length > 253 or
|
||||||
|
lxc_hostname is not regex('^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$')
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
- name: Validate IP address
|
- name: Validate IP address
|
||||||
|
|||||||
@@ -40,9 +40,15 @@
|
|||||||
- name: Validate hostname
|
- name: Validate hostname
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: |
|
msg: |
|
||||||
Invalid hostname: "{{ vm_hostname }}"
|
Invalid hostname: "{{ lxc_hostname }}"
|
||||||
Hostname may only contain letters (a-z, A-Z), numbers (0-9), and hyphens (-).
|
Hostname must:
|
||||||
when: not vm_hostname is regex('^[a-zA-Z0-9-]+$')
|
- contain only letters (a-z, A-Z), digits (0-9), hyphens (-), and dots (.)
|
||||||
|
- not start or end with a hyphen or dot
|
||||||
|
- have each label between 1 and 63 characters
|
||||||
|
- not exceed 253 characters in total
|
||||||
|
when: >
|
||||||
|
lxc_hostname | length > 253 or
|
||||||
|
lxc_hostname is not regex('^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$')
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
- name: Validate IP address
|
- name: Validate IP address
|
||||||
|
|||||||
Reference in New Issue
Block a user