21 lines
647 B
YAML
21 lines
647 B
YAML
---
|
|
|
|
- name: Set default ip
|
|
ansible.builtin.set_fact:
|
|
lxc_ip_address: "192.168.0.90/24"
|
|
|
|
- name: Prompt for IP with immediate validation
|
|
ansible.builtin.pause:
|
|
prompt: "Enter ip in x.x.x.x/x format [192.168.0.90/24]"
|
|
register: ip_result
|
|
until: >
|
|
ip_result.user_input | length == 0 or
|
|
ip_result.user_input is regex('^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)/(3[0-2]|[12]?\\d)$')
|
|
retries: 2
|
|
delay: 0
|
|
|
|
- name: Use user input only if provided, otherwise keep the default
|
|
ansible.builtin.set_fact:
|
|
lxc_ip_address: "{{ ip_result.user_input }}"
|
|
when: ip_result.user_input | length > 0
|