FEATURE: adds a hostname validation for lxc deployment playbook
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
vars_prompt:
|
vars_prompt:
|
||||||
- name: lxc_hostname
|
- name: lxc_hostname
|
||||||
prompt: "Hostname for the container"
|
prompt: "Hostname for the container (may only contain letters (a-z, A-Z), numbers (0-9), and hyphens)"
|
||||||
private: false
|
private: false
|
||||||
|
|
||||||
- name: lxc_root_password
|
- name: lxc_root_password
|
||||||
@@ -25,6 +25,14 @@
|
|||||||
prompt: "IP address for the container (in x.x.x.x/x formant)"
|
prompt: "IP address for the container (in x.x.x.x/x formant)"
|
||||||
private: false
|
private: false
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Validate hostname
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: |
|
||||||
|
Invalid hostname: "{{ lxc_hostname }}"
|
||||||
|
Hostname may only contain letters (a-z, A-Z), numbers (0-9), and hyphens (-).
|
||||||
|
when: not lxc_hostname is regex('^[a-zA-Z0-9-]+$')
|
||||||
|
run_once: true
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ../roles/deploy_lxc_on_proxmox
|
- ../roles/deploy_lxc_on_proxmox
|
||||||
|
|||||||
Reference in New Issue
Block a user