Travis CI | Gem |
---|---|
Supports: Windows, Linux
Virtual Machine Management plugin for Kitchen.
This provider will allow you to create VMs in the remote Virtual Machine Manager via Test Kitchen.
Install kitchen-vmm gem
chef gem 'kitchen-vmm'
- You should have template in your VMM which has following things setup:
- WinRM and firewall configured, using:
winrm quickconfig
- Either domain or local user with admin rights. You can specify its creds using (either in cookbook .kitchen.yml or in $HOME/.kitchen/config.yml):
transport: name: winrm username: <username> password: <password>
- Once VM created in VMM it should automatically get IP assigned, as well as it should be directly accessible from your machine.
- Run kitchen commands under Administrator (in admin shell).
In the .kitchen.yml
Globally
driver:
name: vmm
vm_template_name: default-template
vm_host_group_name: default-group
Or per platform
platforms:
- name: platform1
driver:
name: vmm
vm_template_name: 'overidden-template'
vm_host_group_name: overidden-group
In case you need to create both Linux and Windows machines, then different transport types have to be used(ssh for linux and winrm for windows). For easier maintenance and cleaner configuration you can create global kitchen configuration under $HOME/.kitchen/config.yml with following contents:
<% WINRM_USERNAME = 'winrm_user' %>
<% WINRM_PASSWORD = 'winrm_dassword' %>
# default transport settings
transport:
name: ssh
username: ssh_user
ssh_key: <path_to_key>
# winrm related settings that do not clash with ssh ones can also go here
# example: winrm_transport
Then in your cookbook specific kitchen.yml configure transport either for platform or suite
suites:
- name: windows-basic
run_list:
- recipe[windows-basic::default]
transport:
name: winrm
username: <%= WINRM_USERNAME %>
password: <%= WINRM_PASSWORD %>
-
VMM template name that will be used for VM creation.
driver_config: ... vm_template_name: vagrant-template-w8.1-64
-
VMM host group where VM will be placed. NOTE: Your template or vm_hardware_profile should match it as well.
driver_config: ... vm_host_group_name: 'Host-Group-Name'
-
IP/Hostname of the VMM server where VMs are going to be created.
driver_config: ... vmm_server_address: '192.124.125.10'
-
Specify name of a VM that is going to be created. Default is Kitchen instance name. If VM with such name already exists driver might get random number appended to it.
driver_config: ... vm_name: 'my-vm-in-vmm'
-
Prefix for VM name, all created VMs are going to have name prepended with the specified prefix.
driver_config: ... vm_name_prefix: tst-
-
Specify alternate HW profile that should be used instead of the one provided in your original template.
driver_config: ... vm_hardware_profile: 'TestHW-8core-8gb'
-
If your local machine do not have direct access to the machine that hosts VMM, but you have proxy server(jump box) you can specify its IP in proxy_server_address property.
driver_config: ... proxy_server_address: 'my-proxy-to-vmm'
-
You can tell the provider to move your VM under some particular OU once it's created.
URL of AD server. Can be derived by running
echo %LOGONSERVER%
command in CMD of the VM environment.Example:
driver_config: ... ad_server: 'my-ad-server.some.domain.local'
-
Base DN container where VM appears(and it will be moved from) once it's created. Example:
driver_config: ... ad_source_path: 'CN=Computers,DC=some,DC=domain,DC=local'
-
New AD path where VM should be moved to. Example:
driver_config: ... ad_target_path: 'OU=Vagrant,OU=Chef-Nodes,DC=some,DC=domain,DC=local'
Check that winrm is configured properly in the VM, if username/password is local then ensure you've set winrm transport to plaintext for kitchen.
transport:
name: winrm
...
winrm_transport: plaintext
and enable basic auth and unencrypted connection in a VM.
winrm set winrm/config/service/auth @{Basic="true"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
and on your local machine
winrm set winrm/config/client/auth @{Basic="true"}
Run following command on your machine as well:
winrm set winrm/config/service @{AllowUnencrypted="true"}
- Fork it ( https://github.com/[my-github-username]/kitchen-vmm/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request