Add regexp to drop spaces from hostnames in prompts.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill 2025-03-25 19:22:40 -04:00
parent 6d9ff9b5f2
commit aa5691d1b5
2 changed files with 6 additions and 4 deletions

View file

@ -19,9 +19,10 @@
- name: find instances
vars_prompt:
- name: target
prompt: What is the target vhost
prompt: What is the target vhost (to reboot)
private: false
hosts: "{{ target }}"
# Use a simple regexp to ignore spaces people might accidentally paste.
hosts: "{{ target | regex_search('[-a-z0-9.]+')}}"
gather_facts: false
user: root

View file

@ -8,9 +8,10 @@
- name: Find instances
vars_prompt:
- name: target
prompt: What is the target vhost
prompt: What is the target vhost (to upgrade)
private: false
hosts: "{{ target }}"
# Use a simple regexp to ignore spaces people might accidentally paste.
hosts: "{{ target | regex_search('[-a-z0-9.]+')}}"
gather_facts: false
user: root