How to change Linux guest OS name after clone vmware Linux VM

24 views
Skip to first unread message

Danny Ben Av

unread,
Aug 25, 2016, 1:06:47 PM8/25/16
to Ansible Project
Hello,

I new user with Ansible ,  I use this Playbook , but how can i change the Linux guest vm after cloning . when i clone the vm machine i get the same host name . i would like to use the name in the host.vms file .

Thank You ,

this is my playbook

#>  ansible-playbook -i hosts.vms clone_playbook.yml

host.vms
[vmcreate]
mfp-svt-trial77  datastore='Qa-DataStore' network='NET-10.100.227.0/25'

clone_playbook.yml
---
- hosts: vmcreate
  gather_facts: false
  connection: local
  user: remote
  sudo: true

  vars:
    vcenter_hostname: 'wl-manager01.mydomain.com'
    vcenter_user: 'dan...@maydomain.com'
    vcenter_pass: 'mypassword'
    datacenter: 'MFP-DOM'
    esxi_host: 'wl-esxi510-qa.mydomain.com'
    folder: 'SVT-Automation'
    notes: 'Created by Ansible'

  tasks:
    - vsphere_guest:
        vcenter_hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        guest: "{{ inventory_hostname }}"
        from_template: yes
        template_src: mfp-vm-basic
        cluster: mfp
        validate_certs: no
        vm_extra_config:
          notes: "{{ notes }}"
          folder: "{{ folder }}"
        esxi:
          datacenter: "{{ datacenter }}"
          hostname: "{{ esxi_host }}"

Reply all
Reply to author
Forward
0 new messages