Hi Mark, 

bit confusion, need your suggestion...

i made a play book to create vm machine and  attached iso_path. when i run 
the playbook it creates a vm automatically boot from rhel6 iso. 
if it is booting from iso automatically then why i need to use pxe ? can i 
install rhel6 OS by kickstart ? if yes then what more syntax i need to 
define in my script.
please find the below mentioned my playbook and suggest me the right way.

---
- name: create some vms
  hosts: localhost
  connection: local
  vars_prompt:
    - name: "vcenter_host"
      prompt: "Enter vcenter host"
      private: no
      default: "vcsa"
    - name: "vcenter_user"
      prompt: "Enter vcenter username"
      private: no
    - name: "vcenter_pass"
      prompt: "Enter vcenter password"
      private: yes
    - name: "vcenter_datacenter"
      prompt: "Enter datacenter name"
      private: no
    - name: "vcenter_datastore"
      prompt: "Enter datastore name"
      private: no
    - name: "esxi_host"
      prompt: "Enter vsphere host"
      private: no
  vars:
#    - vcenter_folder: 'beta'
    - vms:
        - guest: 'test04'
          state: 'powered_on'
          vcpu_hotadd: 'yes'
          mem_hotadd: 'yes'
          notes: 'Ansible Created'
          num_disks: '1'
          disks:
            disk1:
              size: '10'
              type: 'thin'
          network: 'VM Network'
          memory: '1024'
          cpus: '1'
          osid: 'rhel6_64Guest'
  tasks:
    - name: create vms (Single Disk)
      vsphere_guest:
        vcenter_hostname: "{{ vcenter_host }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        guest: "{{ item.guest }}"
        state: "{{ item.state }}"
        vm_extra_config:
          vcpu.hotadd: "{{ item.vcpu_hotadd|default(omit) }}"
          mem.hotadd: "{{ item.mem_hotadd|default(omit) }}"
          notes: "{{ item.notes|default(omit) }}"
 #         folder: "{{ vcenter_folder }}"
        vm_disk:
          disk1:
            size_gb: "{{ item.disks.disk1.size }}"
            type: "{{ item.disks.disk1.type }}"
            datastore: "{{ vcenter_datastore }}"
 #          folder: "{{ vcenter_folder }}"
        vm_nic:
          nic1:
            type: "vmxnet3"
            network: "{{ item.network }}"
            network_type: "standard"
        vm_hardware:
          memory_mb: "{{ item.memory }}"
          num_cpus: "{{ item.cpus }}"
          osid: "{{ item.osid }}"
          scsi: "paravirtual"
          vm_cdrom:
            type: "iso"
            iso_path: "datastore1/rhel-server-6.6-x86_64-dvd.iso"
        esxi:
          datacenter: "{{ vcenter_datacenter }}"
          hostname: "{{ esxi_host }}"
      with_items: vms
      when: item.num_disks == '1'


On Wednesday, November 11, 2015 at 10:48:29 PM UTC+5:30, Mark Phillips 
wrote:
>
> Hello Mihai,
>
> Well, it's two other products there that are in effect needing control of. 
> You need vSphere to interact with the Linux boot disc menu - so not easy, 
> really.
>
> See my earlier post in this thread - set up a network boot (PXE) and have 
> two menu items. Or, alternatively, use something like iPXE (
> http://ipxe.org) to make a specific boot disc image which you 'insert' 
> into the VMware VM CDROM to boot.
>
> Cheers
>
> On Wednesday, 11 November 2015 16:58:00 UTC, Mihai Cristian Satmarean 
> wrote:
>>
>> Thanks Mark,
>> We are already doing both, I thought that there is a module or an Ansible 
>> trick that you can specify the boot parameter in the vsphere boot :) that 
>> would be helpful.
>>
>>
>> vineri, 6 noiembrie 2015, 18:33:56 UTC+1, Mark Phillips a scris:
>>>
>>> If it's from a CD boot Mihai just hit 'tab' then put ks= as Michael 
>>> suggested.
>>>
>>> Otherwise, with PXE boot you can specify the option on the kernel line, 
>>> like:
>>>
>>> kernel -n img 
>>> http://ks.internal/centos/7/os/x86_64/images/pxeboot/vmlinuz ks=
>>> http://ks.internal/bootstrap/ks/7.ks
>>>
>>> On Friday, 6 November 2015 16:19:23 UTC, Mihai Cristian Satmarean wrote:
>>>>
>>>> @Michael, thanks! This might be exactly what I am looking for in this 
>>>> stage, but I cannot find an example of how to insert the arguments at boot 
>>>> to point to the remote kickstart.
>>>>
>>>> Mihai Satmarean
>>>>
>>>> miercuri, 7 ianuarie 2015, 18:10:38 UTC+1, Michael DeHaan a scris:
>>>>>
>>>>> If you don't want to bake in the ks.cfg (for instance, if you have 
>>>>> different install profiles coming off the same OS), supplying the kernel 
>>>>> argument ks=http://server.example.com/foo.ks also works.
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jan 7, 2015 at 11:28 AM, Earl Robinson <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Parimal,
>>>>>>
>>>>>> To use kickstart you first need to present a boot media which is 
>>>>>> configured to pull the kickstart file
>>>>>> See: 
>>>>>> http://www.centos.org/docs/5/html/5.2/Installation_Guide/s1-kickstart2-howuse.html
>>>>>>
>>>>>> You can use ansible to present the VM with such bootable media by 
>>>>>> launching it in a VLAN with a PXE boot server which will present the 
>>>>>> media, 
>>>>>> or by presenting the VM with a CD image with the kickstart file built in.
>>>>>>
>>>>>> I've gone the CD image route with ansible, you can specify a cd image 
>>>>>> to boot like this:
>>>>>>
>>>>>> vsphere_guest:
>>>>>>   vm_hardware:
>>>>>>     vm_cdrom:
>>>>>>       type: "iso"
>>>>>>       iso_path: "DatastoreName/cd-image.iso"
>>>>>>
>>>>>> Of course you need to give the vsphere_guest module all other 
>>>>>> required arguments, but this is the simplest way I've found to kiskstart 
>>>>>> a 
>>>>>> vm using ansible.
>>>>>>
>>>>>> -earl
>>>>>>
>>>>>>
>>>>>> On Tue, Jan 6, 2015 at 4:07 AM, Patel Parimal <[email protected]> 
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> I am newbie to Ansible. 
>>>>>>>
>>>>>>> I have gone through the online documentation and examples for 
>>>>>>> creating new VM on Ansible Docs - vsphere_guest (
>>>>>>> http://docs.ansible.com/vsphere_guest_module.html).
>>>>>>>
>>>>>>> I want to automate VM creation and OS installation process using 
>>>>>>> Ansible.
>>>>>>>
>>>>>>> Currently I have VMWare ESXi available which doesn't support VM 
>>>>>>> cloning, so I need to create a new VM every time from scratch and 
>>>>>>> install 
>>>>>>> OS(RHEL 6) into it.
>>>>>>>
>>>>>>> Is there any way to provide kickstart file URL in Ansible Playbook 
>>>>>>> (for example, static HTTP URL like http://192.168.0.1/ks/ks.cfg) so 
>>>>>>> after newly built VM is powered on, OS will be installed into it ?
>>>>>>>
>>>>>>> Thanks and regards,
>>>>>>> Parimal
>>>>>>>
>>>>>>> -- 
>>>>>>> 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 [email protected].
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/ansible-project/da56aeef-01f0-41f6-8dc9-3cd1bdd138d5%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/ansible-project/da56aeef-01f0-41f6-8dc9-3cd1bdd138d5%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/ansible-project/CABGf5APRF_HeN%3Dgyvh0UGdBP%2BV8AeLsaXZZR1SYX833C17wrkQ%40mail.gmail.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/ansible-project/CABGf5APRF_HeN%3Dgyvh0UGdBP%2BV8AeLsaXZZR1SYX833C17wrkQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6fe8e245-4544-4310-a31a-e4ff2eed8f18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to