We have recently setup a similar workflow for RHEL 6 and 7.  Here are the 
steps if anyone is interested.

   1. We enter the server's information into our custom database (MySQL) 
   that we use to track our inventory.  We also use this table to create our 
   dynamic inventory for Ansible.  The table contains the server's name, IP 
   and other server specific information.
   2. We kick off an Ansible playbook that does the following
      - Checks to see if the VM has already been created
      - Creates the VM using the vsphere_guest module.  The VM is setup to 
      boot on a network with DHCP.
      - Collects facts about the VM.    We need this in order to get the 
      MAC address of the newly created VM.
      - Updates our database with the MAC of the new VM.
      - Powers on the new VM.
   3. The server is powered on with a custom RHEL ISO attached.  The custom 
   ISO is pointing to web service that will dynamically build our kickstart 
   file. (http://kickstart.example.com/ws/ks.php).  The custom ISO also has 
   the inst.ks.sendmac, ks.sendmac and kssendmac parameters set on the kernel 
   line.  This will send the VM's MAC address to the web service which allow 
   it to figure out the VM's IP information.
   4. The kickstart script installs base packages, subscribes the VM with 
   Satellite, installs VM tools and adds the server to our AD domain.  The 
   last thing the script does is send a web call to a web service that will 
   change the VM's network from the DHCP network to the network that the VM is 
   supposed to be on.
   5. Once the VM is up it is ready to have our standard Ansible plays ran 
   on it.

Our last deployment consisted of 4 servers, we had the entire environment 
up and running and ready to hand off to our customer in 15 minutes!

Ansible rocks, thanks to the Ansible team for such a great product!


Hiatt
 



On Wednesday, January 7, 2015 at 1:25:45 PM UTC-6, Stephen Granger wrote:
>
> Hi Mark,
>
> Thanks for posting that code, I've been unsure of how to extra the mac 
> address for newly created VM's. I can now parse that to cobbler to 
> create/update vm's.
>
> Is anyone else using a similar workflow? I'm only using cobbler because we 
> presently use it allows us to use our existing kickstart files.
>
>
> Thanks!
>
> On 7 January 2015 at 09:49, Mark Phillips <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> I've recently done just this - and I coupled the VM creation with PXE 
>> booting. I have two PXE menus in place, the default one just says 'boot to 
>> HD'. The other one is the install menu, with a kickstart line. I control 
>> the use of this with Ansible by doing the following:
>>
>> https://gist.github.com/phips/2777a564e10d53824df8
>>
>>
>> On Tuesday, 6 January 2015 10:07:53 UTC+1, Patel Parimal 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4af2ebed-cecb-4ba1-964a-bd76c0e128ed%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4af2ebed-cecb-4ba1-964a-bd76c0e128ed%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Steve
>  

-- 
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/32b052b6-2378-42bf-a30f-df5dd70d44b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to