Hi

I have a playbook which create the vm in vCenter 
---
- hosts: localhost
  gather_facts: false
  connection: local
  vars_files:
    - ./vars/xxx.yml

  tasks:


    - name: Create VM using template
      vmware_guest:
        hostname: "{{ vcenter_server }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        datacenter: "{{ vcenter_datacenter }}"
        cluster: "{{ vcenter_cluster }}"
        template: "{{ vcenter_template }}"
  ..
          hostname: "{{ item }}"
      with_items: "{{ servers }}"




    - name: Update the Inventory
      lineinfile:
        dest: /etc/ansible/hosts
        insertafter: '^\[MyServers\]'
        line: '{{ item }}'
      with_items: "{{ servers }}"
      run_once: true



VM create works well, Any suggestions why the the hosts file is not getting 
updated .. above is the code 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/542ded49-eab9-4fbf-8faa-2ba91bc3517en%40googlegroups.com.

Reply via email to