Skip to content

Commit

Permalink
Initial examples directory
Browse files Browse the repository at this point in the history
Some better examples for everyone!

Signed-off-by: JJ Asghar <[email protected]>
  • Loading branch information
JJ Asghar committed Jun 15, 2017
1 parent ee3a469 commit 88d97de
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AllCops:
- "vendor/**/*"
- "pkg/**/*"
- "vsphere_testing/**/*"
- "examples/**/*"
- "spec/unit/plugins/darwin/system_profiler_output.rb"

inherit_from: .rubocop_todo.yml
45 changes: 45 additions & 0 deletions examples/ubuntu-kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
driver:
name: vsphere
driver_options:
host: '172.16.20.2'
user: '[email protected]'
password: 'PASSWORD'
insecure: true
machine_options:
start_timeout: 600
create_timeout: 600
ready_timeout: 90
bootstrap_options:
use_linked_clone: true
datacenter: 'Datacenter'
template_name: 'ubuntu16'
template_folder: 'Linux'
resource_pool: 'Cluster'
num_cpus: 2
memory_mb: 4096
ssh:
user: ubuntu
paranoid: false
password: PASSWORD
port: 22

provisioner:
name: chef_zero
sudo_command: sudo

verifier:
name: inspec

transport:
username: "admini"
password: admini

platforms:
- name: ubuntu-16.04

suites:
- name: default
run_list:
- recipe[vsphere_demo::default]
attributes:
35 changes: 35 additions & 0 deletions examples/ubuntu-provision.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'chef/provisioning'
require 'chef/provisioning/vsphere_driver'

#
# This is the main way to connect to vSphere
#
with_vsphere_driver host: '172.16.20.2',
insecure: true,
user: '[email protected]',
password: 'PASSWORD'

#
# These are the machine_options that you need to declare
#
with_machine_options :bootstrap_options => {
num_cpus: 2,
memory_mb: 4096,
datacenter: 'Datacenter',
resource_pool: 'Cluster',
template_folder: 'Linux',
template_name: 'ubuntu16',
:ssh => {
:user => 'admini',
:password => 'PASSWORD',
:paranoid => false,
}
},
:sudo => true

#
# This is where you can declare the machine
#
machine "testing-ubuntu" do
tag "haha"
end
47 changes: 47 additions & 0 deletions examples/win-provision.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'chef/provisioning'
require 'chef/provisioning/vsphere_driver'


#
# This is the main way to connect to vSphere
#
with_vsphere_driver host: '172.16.20.2',
insecure: true,
user: '[email protected]',
password: 'PASSWORD'

#
# These are the machine_options that you need to declare
#
win_bootstrap_options = { :bootstrap_options => {
num_cpus: 2,
memory_mb: 8096,
datacenter: 'Datacenter',
resource_pool: 'Cluster',
template_folder: 'Windows',
template_name: 'windows2012R2',
:ssh => {
:user => 'Administrator',
:password => 'P@ssw0rd!!!',
:paranoid => false,
:port => "5985"
}
},
ssh_options: { :keepalive => true, :keepalive_interval => 50, :user_known_hosts_file => '/dev/null' },
ready_timeout: '30'
}

#
# WinRM requires a Chef server (not sure why) so you need to declare it here
#
with_chef_server "https://api.chef.io/organizations/ORG",
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]

#
# This is where you can declare the machine
#
machine "testing-windows" do
machine_options win_bootstrap_options
tag "haha"
end
63 changes: 63 additions & 0 deletions examples/win-ubuntu-kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
driver:
name: vsphere
driver_options:
host: '172.16.20.2'
user: '[email protected]'
password: 'PASSWORD'
insecure: true
machine_options:
start_timeout: 600
create_timeout: 600
ready_timeout: 90
bootstrap_options:
use_linked_clone: true
datacenter: 'Datacenter'
template_name: 'ubuntu16'
template_folder: 'Linux'
resource_pool: 'Cluster'
num_cpus: 2
memory_mb: 4096
ssh:
user: ubuntu
paranoid: false
password: 'PASSWORD'
port: 22

provisioner:
name: chef_zero
sudo_command: sudo

verifier:
name: inspec

transport:
username: "ubuntu"
password: 'PASSWORD'

platforms:
- name: ubuntu-16.04
- name: windows
driver:
machine_options:
start_timeout: 600
create_timeout: 600
ready_timeout: 90
bootstrap_options:
use_linked_clone: true
datacenter: 'Datacenter'
template_name: 'windows2012R2'
template_folder: 'Windows'
resource_pool: 'Cluster'
num_cpus: 2
memory_mb: 8096
ssh:
user: "administrator"
paranoid: false
password: "P@ssw0rd!!!!"
port: 5985

suites:
- name: default
run_list:
- recipe[my_cookbook::default]

0 comments on commit 88d97de

Please sign in to comment.