Guest User

Untitled

a guest
Nov 21st, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. ---
  2. - hosts: localhost
  3. gather_facts: false
  4. connection: local
  5.  
  6. vars_files:
  7. - envanswer.yml
  8. vars:
  9. folder: "{{ folder }}"
  10.  
  11. tasks:
  12. - name: Gather VM information for all VMs present
  13. vmware_vm_facts:
  14. hostname: "{{ vcenter }}"
  15. username: "{{ vcenter_user }}"
  16. password: "{{ vcenter_pass }}"
  17. validate_certs: False
  18. delegate_to: localhost
  19. register: vmfacts
  20. when: vmfacts.virtual_machines | search("masters")
  21.  
  22. - debug:
  23. var: vmfacts.virtual_machines
  24.  
  25. fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 'vmfacts.virtual_machines | search("masters")' failed. The error was: error while evaluating conditional (vmfacts.virtual_machines | search("masters")): 'vmfacts' is undefinednnThe error appears to have been in '/home/deploy/ansible/vmfacts.yml': line 12, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nn tasks:n - name: Gather VM information for all VMs presentn ^ heren"}
Add Comment
Please, Sign In to add comment