Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Move define resource razor::system to tests.
Browse files Browse the repository at this point in the history
The define resource type is specific to ubuntu and it's not generic
enough to be in the module, but it should serve as a good example for
anyone using the razor resources to model systems.
  • Loading branch information
nanliu committed Oct 8, 2012
1 parent 9744530 commit 792a74a
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 65 deletions.
38 changes: 0 additions & 38 deletions manifests/system.pp

This file was deleted.

65 changes: 39 additions & 26 deletions tests/openstack.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
# Example Openstack
# Deploying Ubuntu Precise
define razor::system (
$hostprefix = $name,
$domain,
$password,
$tag_matcher = [],
$broker = 'none',
$instances = '0',
$image = 'precise',
$policy_template = 'linux_deploy',
$model_template = 'ubuntu_precise',
) {

rz_model { $name:
ensure => present,
image => $image,
metadata => { 'domainname' => $domain,
'hostname_prefix' => $hostprefix,
'root_password' => $password, },
template => $model_template,
}

rz_tag { $name:
tag_label => $name,
tag_matcher => $tag_matcher,
}

rz_policy { $name:
ensure => 'present',
broker => $broker,
model => $name,
enabled => 'true',
tags => [$name],
template => 'linux_deploy',
maximum => $instances,
}
}

# Example Openstack Desployment on UCS hardware.
rz_image { 'rz_mk_prod-image.0.9.0.4.iso':
ensure => present,
type => 'mk',
Expand All @@ -12,31 +50,6 @@
source => '/opt/razor/ubuntu-12.04.1-server-amd64.iso',
}

razor::system { 'danscontroller':
domain => 'dmz25.lab',
password => 'test1234',
instances => 1,
image => 'Precise',
tag_matcher => [
{ 'key' => 'macaddress_eth0',
'compare' => 'equal',
'value' => '00:25:B5:00:05:CF',
'inverse' => false,
} ],
} ->
razor::system { 'danscompute':
domain => 'dmz25.lab',
password => 'test1234',
instances => 1,
image => 'Precise',
tag_matcher => [
{ 'key' => 'macaddress_eth0',
'compare' => 'equal',
'value' => '00:25:B5:00:05:2F',
'inverse' => false,
} ],
} ->

razor::system { 'compute':
domain => 'dmz25.lab',
password => 'test1234',
Expand Down
39 changes: 38 additions & 1 deletion tests/system.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
# Example for how to specify per host policy based on macaddress.
# Deploying Ubuntu precise.
define razor::system (
$hostprefix = $name,
$domain,
$password,
$tag_matcher = [],
$broker = 'none',
$instances = '0',
$image = 'precise',
$policy_template = 'linux_deploy',
$model_template = 'ubuntu_precise',
) {

rz_model { $name:
ensure => present,
image => $image,
metadata => { 'domainname' => $domain,
'hostname_prefix' => $hostprefix,
'root_password' => $password, },
template => $model_template,
}

rz_tag { $name:
tag_label => $name,
tag_matcher => $tag_matcher,
}

rz_policy { $name:
ensure => 'present',
broker => $broker,
model => $name,
enabled => 'true',
tags => [$name],
template => 'linux_deploy',
maximum => $instances,
}
}

rz_image { 'rz_mk_prod-image.0.9.0.4.iso':
ensure => present,
Expand All @@ -13,6 +49,7 @@
source => 'http://releases.ubuntu.com/12.04/ubuntu-12.04.1-server-amd64.iso',
}

# Example for how to specify per host policy based on macaddress.
razor::system { 'demo':
domain => 'dmz25.lab',
password => 'test1234',
Expand Down

0 comments on commit 792a74a

Please sign in to comment.