From aa5691d1b56cb9d9fb229e0ecb6cee5e3f991103 Mon Sep 17 00:00:00 2001 From: James Antill Date: Tue, 25 Mar 2025 19:22:40 -0400 Subject: [PATCH] Add regexp to drop spaces from hostnames in prompts. Signed-off-by: James Antill --- playbooks/vhost_reboot.yml | 5 +++-- playbooks/vhost_update.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/playbooks/vhost_reboot.yml b/playbooks/vhost_reboot.yml index 40fd487935..3a4a658124 100644 --- a/playbooks/vhost_reboot.yml +++ b/playbooks/vhost_reboot.yml @@ -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 diff --git a/playbooks/vhost_update.yml b/playbooks/vhost_update.yml index f45ff59d31..d43a86773b 100644 --- a/playbooks/vhost_update.yml +++ b/playbooks/vhost_update.yml @@ -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