diff --git a/playbooks/vhost_reboot.yml b/playbooks/vhost_reboot.yml index 3a4a658124..0396573a4e 100644 --- a/playbooks/vhost_reboot.yml +++ b/playbooks/vhost_reboot.yml @@ -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 diff --git a/playbooks/vhost_update.yml b/playbooks/vhost_update.yml index d43a86773b..6a7267ecf1 100644 --- a/playbooks/vhost_update.yml +++ b/playbooks/vhost_update.yml @@ -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