We do something similar with our builds. The last thing we do in the post 
section of our Kickstart script is make a web service call. The web service 
moves the VM to the correct network. 

> On Nov 12, 2015, at 04:34, Mihai Cristian Satmarean 
> <[email protected]> wrote:
> 
> Great Mark - *There is always a way* even if is the crazyest way :)
> I will investigate for now the wait for idea and ping the port or something.
> Thanks a lot!
> 
> joi, 12 noiembrie 2015, 10:27:35 UTC+1, Mark Phillips a scris:
>> 
>> Not a problem Mihai! *There is always a way*.
>> 
>> There are choices here, as per usual - you could always use 'wait_for'[1] in 
>> an Ansible play, or you could use a 'phone home' type solution - i.e. the 
>> newly provisioned virtual machine boots and the first thing it does is 'look 
>> for' a centralised Ansible point to tell it 'hello, I'm booted'.
>> 
>> This is an example I did with Amazon earlier this year of a phone home - 
>> https://github.com/phips/tiad_demo/blob/master/plays/new.yml#L31 The actual 
>> script, highlighted in that line, is here: 
>> https://github.com/phips/tiad_demo/blob/master/scripts/ec2_bootstrap.sh All 
>> it is doing is a curl back an Ansible Tower instance, which runs a given job 
>> against the newly booted machine.
>> 
>> Hope that helps.
>> 
>> [1] http://docs.ansible.com/ansible/wait_for_module.html
>> 
>>> On Thursday, 12 November 2015 08:11:44 UTC, Mihai Cristian Satmarean  wrote:
>>> Hi Mark,
>>> 
>>> I get your point. Sorry for not being very clear (I am working on that).
>>> I am using this already  based on what is out there, 
>>> what I only miss is a way from vSphere to tell back to Ansible that the VM 
>>> was rebooted.
>>> that would be the killer feature for now.
>>> Thanks!
>>> 
>>> miercuri, 11 noiembrie 2015, 18:18:29 UTC+1, Mark Phillips a scris:
>>>> 
>>>> 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.
>>>>>>>>>> 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.
>>>>>>>>> 
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/Holm0CFBbLo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/89f7f8d3-7449-47ff-8c35-b30b0c3e914a%40googlegroups.com.
> 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/9B38D166-B119-45A1-9133-F7AAD0F24F58%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to