I have been trying to use test-kitchen with openstack to spin up a windows box, I am attempting to use the user_data section of the openstack driver to pass powershell commands to openstack to run on boot. but it fails to run the code I provide for user_data, and it doesn’t throw any errors until I tries to connect to the vm via winrm.
-----> Creating <default-WindowsServer2012R2>...
OpenStack instance with ID of <xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx> is ready.
Attaching floating IP from <ext_vlan1768_net> pool
Attaching floating IP <10.63.xxx.xx>
Waiting for server to be ready...
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Waiting for WinRM service on http://10.63.xxx.xx:5985/wsman, retrying in 3 seconds
Here is my kitchen.yml
---
# Open Stack Config
#Jjp6WbrIf5Bzvy
driver:
name: openstack
key_name: "id_rsa_pub"
driver_config:
user_data: userdata.txt
# All the following top level driver options can be set in your
# ~/.kitchen/config.yml to suit your personal needs
# The following driver options depend upon values set from an OpenStack
# RC file. See OpenStack -> Access & Security -> API Access for the
# download OpenStack RC File button.
openstack_username: <%= ENV['OS_USERNAME'] %>
openstack_api_key: <%= ENV['OS_PASSWORD'] %>
openstack_auth_url: <%= ENV['OS_AUTH_URL'] %>/tokens
openstack_tenant: <%= ENV['OS_TENANT_NAME'] %>
# This driver option is the Target standard value to use for an IP addr.
# It must match the external network your OS network is connected with.
# floating_ip_pool: ext_vlan1722_net
# network_ref: the ID of the network created for your project
floating_ip_pool: ext_vlan1768_net
network_ref: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
provisioner:
name: chef_zero_scheduled_task
chef_metadata_url: http://www.chef.io/chef/metadata?p=windows&m=x86_64&pv=2012r2&v=12.5.1
platforms:
- name: WindowsServer2012R2
driver:
name: openstack
flavor_ref: mmem-2vcpu
image_ref: "Windows-Server-2012-std-fast"
username:
private_key_path: <%= ENV['HOME'] %>/.ssh/id_rsa
public_key_path: <%= ENV['HOME'] %>/.ssh/id_rsa_pub.pub
suites:
- name: default
run_list:
- recipe[settings_ost::default]
Here is what I have in my userdata.txt
mkdir 'c:\test'
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
net stop winrm
sc.exe config winrm start=auto
net start winrm
mkdir 'c:\test2'
Does anyone have any advice, or tips on what I am missing? I have searched all over the internet and I haven’t found any examples. I found the idea from the kitchen-openstack gem documentation on GitHub. https://github.com/test-kitchen/kitchen-openstack#user_data