« Previous -
Version 28/69
(diff) -
Next » -
Current version
Corey Osman, 10/13/2011 04:40 am
ESX Integration¶
Preface¶
This topic is a work in progress. I have not made foreman work with ESX server 100% but I wanted to at least copy my notes here for others to hack away at.
Although ESX and ESXi are different products they should be considered identical when it comes to working with the Vmware SDK.
Furthermore, vSphere is almost identical to ESX SDK with the exception that vSphere has additional objects and actions available to choose from when using the SDK.
All of these "ESX" products implement the [[http://www.vmware.com/support/developer/vc-sdk/]Vsphere SDK] through Https
Requirements¶
- libvirt 0.8.3+ (not totally sure on this) but I know it doesn't work with 0.8.1
- ruby-libvirt 0.4.0
- ESX, ESXi, vsphere server, VMware Server
- A CA (Certificate Authority) to sign new certificates (psst, use your puppet CA or other CA you might have)
- RHEL6 or CentOS6 (not required but its what I use)
Summary¶
- Install libvirt
- Install ruby-libvirt gem
- Create ssl key
- Sign key with CA cert and CA key
- Transfers these keys to your ESX or Vsphere server
- Copy CA cert and client cert
- Test with virsh
- Setup hypervisor in foreman
Detail Instructions¶
Install libvirt¶
I tried various versions. The latest has too many dependancies so I stuck with 0.9.1 which is perfect for what I need.
I have compiled some RPMs to make it easier to install but you may need to resolve some additional dependancies.
This shouldn't be too bad if you have the EPEL repo.
http://www.logicminds.biz/rpms/libvirt-0.9.1-1.el6.x86_64.rpm
http://www.logicminds.biz/rpms/libvirt-client-0.9.1-1.el6.x86_64.rpm
http://www.logicminds.biz/rpms/libvirt-devel-0.9.1-1.el6.x86_64.rpm
http://www.logicminds.biz/rpms/libvirt-python-0.9.1-1.el6.x86_64.rpm
You will need to use the following to install all the rpms once downloaded.
yum -y --nogpgcheck localinstall libvirt-*
or
rpm -Uvh libvirt-*
Install libvirt gem¶
gem install ruby-libvirt
Create SSL Key¶
certtool --generate-privkey > pdxesx.logicminds.corp-key.pem
Sign key with CA cert and CA key¶
[root@puppet ~]# certtool --generate-certificate --load-privkey pdxesx.logicminds.corp-key.pem --load-ca-certificate /etc/puppetlabs/puppet/ssl/ca/ca_crt.pem --load-ca-privkey /etc/puppetlabs/puppet/ssl/ca/ca_key.pem --template server.info --outfile pdxesx.logicminds.corp.pem Generating a signed certificate...
# Server.info organization = Logic Minds Corp cn = pdxesx.logicminds.corp tls_www_server encryption_key signing_key
Transfer these keys to your ESX or Vsphere server¶
You may need to enable ssh on your esx server. Not sure what to do for vsphere since its windows.
scp pdxesx.logicminds.corp-key.pem root@pdxesx:/etc/vmware/ssl/rui.key scp pdxesx.logicminds.corp.pem root@pdxesx:/etc/vmware/ssl/rui.crt
Copy CA cert¶
Since I used puppet as my CA and client I can just reuse the keys and certs I already have.
ln -s /etc/puppetlabs/puppet/ssl/private_keys/puppet.logicminds.corp.pem /etc/pki/libvirt/private/clientkey.pem ln -s /etc/puppetlabs/puppet/ssl/public_keys/puppet.logicminds.corp.pem /etc/pki/libvirt/clientcert.pem ln -s /etc/puppetlabs/puppet/ssl/ca/ca_crt.pem /etc/pki/CA/cacert.pem
Test with virsh¶
I created a foreman user on my esx server
[root@puppet ~]# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # connect esx://foreman@192.168.11.31?no_verify=1
Enter foreman's password for 192.168.11.31:
virsh # version
Compiled against library: libvir 0.9.1
Using library: libvir 0.9.1
Using API: ESX 0.9.1
Running hypervisor: ESX 4.1.0
virsh # list
Id Name State
----------------------------------
16 puppetagent1 running
Setup hypervisor in Foreman¶
URI
esx://foreman@192.168.11.31
I think one issue with foreman is that there is now way to enter in authentication information.
http://libvirt.org/ruby/examples/open_auth.rb
Foreman needs to support open_auth which I don't think it currently does.
Reference Material¶
http://libvirt.org/remote.html#Remote_TLS_server_certificates
