3

I'm trying to use ansible to automate VM deployment in my infrastructure.

So, I used the module "vmware_guest" https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html

I used exactly the same playbook than in the exemple, this is my playbook :

---
- name: Création d'une VM à partir d'un template
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  - name: Clone du template
    vmware_guest:
      hostname: 192.168.102.XXX
      username: administrator@vsphere.local
      password: XXX
      validate_certs: False
      name: AnsibleTest
      template: Template_RH7.3
      datacenter: DataCenterUEM
      folder: /DataCenterUEM/vm/MLD/Linux
      state: present
      wait_for_ip_address: yes

My configuration is ok because i'm able to get some infos from my datacenter/ESX/cluster thanks to "clusters_facts" or "guest_facts" module.

This is my ansible error :

PLAY [Création d'une VM à partir d'un template] ******************************************************************************************************************************************

TASK [Clone du template] *****************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to create a virtual machine : Unable to access the virtual machine configuration: Unable to access file [VMWUEM_01_Linux_1] Template_RH7.3/Template_RH7.3.vmtx"}
        to retry, use: --limit @/etc/ansible/ansible-vmware/vmware_create_infra.retry

PLAY RECAP *******************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1

The playbook has correctly detect the location of my template "Template_RH7.3" cause i'm able to found the file in vSphere : See my file here

Do you know what's going wrong ?

My ansible version :

ansible 2.7.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, May 23 2018, 14:21:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

Thank you !

Wrest
  • 113
  • 1
  • 11

0 Answers0