Add regexp to drop spaces from hostnames in prompts, for add_host.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill 2025-03-25 20:36:02 -04:00
parent aa5691d1b5
commit f74cd17a23
2 changed files with 4 additions and 2 deletions

View file

@ -40,7 +40,8 @@
with_items: "{{ vmlist.list_vms }}"
- name: add the vmhost to target group
local_action: add_host hostname={{ target }} groupname=target
# Use a simple regexp to ignore spaces people might accidentally paste.
local_action: add_host hostname={{ target | regex_search('[-a-z0-9.]+') }} groupname=target
# Call out to another playbook. Disable any proxies that may live here
- name: update proxy dns if needed

View file

@ -25,7 +25,8 @@
with_items: '{{vmlist.list_vms}}'
- name: Add the vmhost to target group
local_action: add_host hostname={{ target }} groupname=target
# Use a simple regexp to ignore spaces people might accidentally paste.
local_action: add_host hostname={{ target | regex_search('[-a-z0-9.]+') }} groupname=target
# Call out to another playbook. Disable any proxies that may live here
# - include_playbook: update-proxy-dns.yml status=disable proxies=myvms_new:&proxies