Skip to content

Commit

Permalink
Use match instead of equalto (missing in older Jinja2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyr committed Jan 16, 2020
1 parent 1ea38e4 commit 7b1d873
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

- name: Set variable with VM details
set_fact:
vmware_vm_provisioning_vm_tmp: "{{ (vmware_vm_provisioning_vms | selectattr('name', 'equalto', inventory_hostname) | list)[0] }}"
vmware_vm_provisioning_vm_tmp: "{{ (vmware_vm_provisioning_vms | selectattr('name', 'match', '^%s$' % inventory_hostname) | list)[0] }}"
when: >
vmware_vm_provisioning_vms | selectattr('name', 'equalto', inventory_hostname) | list | length > 0
vmware_vm_provisioning_vms | selectattr('name', 'match', '^%s$' % inventory_hostname) | list | length > 0
- block:
- name: Check if the VM already exists
Expand Down

0 comments on commit 7b1d873

Please sign in to comment.