---
recipes/aeolus/manifests/conductor.pp | 86 ++++++++++++++++++++++++++--
recipes/aeolus/manifests/defaults.pp | 14 -----
recipes/aeolus/manifests/image-factory.pp | 41 ++++++++++++++
3 files changed, 120 insertions(+), 21 deletions(-)
diff --git a/recipes/aeolus/manifests/conductor.pp
b/recipes/aeolus/manifests/conductor.pp
index 42ea2fc..05ef72e 100644
--- a/recipes/aeolus/manifests/conductor.pp
+++ b/recipes/aeolus/manifests/conductor.pp
@@ -199,6 +199,32 @@ define aeolus::site_admin($email="",
$password="", $first_name="", $last_name=""
require => Exec[create_site_admin_user]}
}
+# login to the aeolus conductor
+define aeolus::conductor::login($password){
+ web_request{ "$name-conductor-login":
+ post => 'https://localhost/conductor/user_session',
+ parameters => { 'user_session[login]' => "$name",
'user_session[password]' => "$password",
+ 'commit' => 'submit' },
+ returns => '200',
+ follow => true,
+ store_cookies_at => "/tmp/aeolus-$name",
+ require => Service['aeolus-conductor']
+ }
+}
+
+# log out of the aeolus conductor
+define aeolus::conductor::logout(){
+ web_request{ "$name-conductor-logout":
+ post => 'https://localhost/conductor/logout',
+ parameters => { 'user_session[login]' => "admin",
'user_session[password]' => "password",
+ 'commit' => 'submit' },
+ returns => '200',
+ follow => true,
+ use_cookies_at => "/tmp/aeolus-$name",
+ remove_cookies => true
+ }
+}
+
# Create a new provider via the conductor
define aeolus::conductor::provider($type="",$url=""){
web_request{ "provider-$name":
@@ -206,15 +232,60 @@ define
aeolus::conductor::provider($type="",$url=""){
parameters => { 'provider[name]' => $name, 'provider[url]'
=> $url,
'provider[provider_type_codename]' => $type },
returns => '200',
- verify => '.*Provider added.*',
+ contains => "//html/body//li[text() = 'Provider added.']",
follow => true,
- unless => { 'http_method' => 'get',
- 'uri' =>
'https://localhost/conductor/providers',
- 'verify' => ".*$name.*" },
+ use_cookies_at => '/tmp/aeolus-admin',
+ unless => { 'get' =>
'https://localhost/conductor/providers',
+ 'contains' => "//html/body//a[text() =
'$name']" },
require => [Service['aeolus-conductor'],
Exec['grant_site_admin_privs']]
}
}
+# Create a new provider account via the conductor
+define aeolus::conductor::provider::account($provider="", $type="",
$username="",$password="",
$account_id="",$x509private="", $x509public=""){
+ if $type == "mock" {
+ web_request{ "provider-account-$name":
+ post => "https://localhost/conductor/provider_accounts",
+ parameters => { 'provider_account[label]' => $name,
+ 'provider_account[provider]' => $provider,
+ 'provider_account[credentials_hash[username]]' =>
$username,
+ 'provider_account[credentials_hash[password]]' =>
$password,
+ 'quota[max_running_instances]' =>
'unlimited',
+ 'commit' => 'Save' },
+
+ returns => '200',
+ #contains => "//table/thead/tr/th[text() = 'Properties for
$name']",
+ follow => true,
+ use_cookies_at => '/tmp/aeolus-admin',
+ unless => { 'get' =>
'https://localhost/conductor/provider_accounts',
+ 'contains' => "//html/body//a[text() =
'$name']" },
+ require => Service['aeolus-conductor']}
+
+ } elsif $type == "ec2" {
+ web_request{ "provider-account-$name":
+ post => "https://localhost/conductor/provider_accounts",
+ parameters => { 'provider_account[label]' => $name,
+ 'provider_account[provider]' => $provider,
+ 'provider_account[credentials_hash[username]]' =>
$username,
+ 'provider_account[credentials_hash[password]]' =>
$password,
+ 'provider_account[credentials_hash[account_id]]' =>
$account_id,
+ 'quota[max_running_instances]' =>
'unlimited',
+ 'commit' => 'Save' },
+ file_parameters => {
'provider_account[credentials_hash[x509private]]'=> $x509private,
+ 'provider_account[credentials_hash[x509public]]'
=> $x509public },
+
+ returns => '200',
+ #contains => "//table/thead/tr/th[text() = 'Properties for
$name']",
+ follow => true,
+ use_cookies_at => '/tmp/aeolus-admin',
+ unless => { 'get' =>
'https://localhost/conductor/provider_accounts',
+ 'contains' => "//html/body//a[text() =
'$name']" },
+ require => Service['aeolus-conductor']
+ }
+ }
+}
+
+
define aeolus::conductor::hwp($memory='', $cpu='', $storage='',
$architecture=''){
web_request{ "hwp-$name":
post => "https://localhost/conductor/hardware_profiles",
@@ -235,9 +306,10 @@ define aeolus::conductor::hwp($memory='', $cpu='',
$storage='', $architecture=''
returns => '200',
#verify => '.*Hardware profile added.*',
follow => true,
- unless => { 'http_method' => 'get',
- 'uri' =>
'https://localhost/conductor/hardware_profiles',
- 'verify' => ".*$name.*" },
+ use_cookies_at => '/tmp/aeolus-admin',
+ #unless => { 'http_method' => 'get',
+ # 'uri' =>
'https://localhost/conductor/hardware_profiles',
+ # 'verify' => ".*$name.*" },
require => [Service['aeolus-conductor'],
Exec['grant_site_admin_privs']]
}
}
diff --git a/recipes/aeolus/manifests/defaults.pp b/recipes/aeolus/manifests/defaults.pp
index f2fc891..f43fad3 100644
--- a/recipes/aeolus/manifests/defaults.pp
+++ b/recipes/aeolus/manifests/defaults.pp
@@ -7,17 +7,3 @@
#switching back to yum
Package {provider => 'rpm'}
-
-$admin_user='admin'
-$admin_password='password'
-
-# Setup the default login/logout targets for web requests
-Web_request{
- login => { 'http_method' => 'post',
- 'uri' =>
'https://localhost/conductor/user_session',
- 'user_session[login]' => "$admin_user",
- 'user_session[password]' => "$admin_password",
- 'commit' => 'submit' },
- logout => { 'http_method' => 'post',
- 'uri' =>
'https://localhost/conductor/logout' }
-}
diff --git a/recipes/aeolus/manifests/image-factory.pp
b/recipes/aeolus/manifests/image-factory.pp
index 0bb9e72..69f8146 100644
--- a/recipes/aeolus/manifests/image-factory.pp
+++ b/recipes/aeolus/manifests/image-factory.pp
@@ -2,6 +2,13 @@
class aeolus::image-factory inherits aeolus {
+ # image factory client
+ package { 'rubygem-aeolus-image': ensure => 'installed' }
+ file{"/root/.aeolus-cli":
+ source =>
"/usr/lib/ruby/gems/1.8/gems/aeolus-image-0.1.0/examples/aeolus-cli",
+ require => Package['rubygem-aeolus-image'] }
+
+ # image factory services
package { 'libvirt':
ensure=> 'installed'
}
@@ -61,3 +68,37 @@ class aeolus::image-factory::disabled {
exec{"remove_aeolus_templates": command => "/bin/rm -rf
/templates"}
}
+define aeolus::image($template, $provider='', $target=''){
+ exec{"build-$name-image": logoutput => true, timeout => 0,
+ command => "/usr/sbin/aeolus-configure-image $name $target $template
$provider",
+ require => Service['aeolus-conductor']}
+
+ web_request{ "deployment-$name":
+ post => "https://localhost/conductor/deployments",
+ parameters => { 'deployable_url' =>
"http://localhost/deployables/$name.xml",
+ 'deployment[name]' => $name,
+ 'deployment[pool_id]' => '1',
+ 'deployment[frontend_realm_id]' => '' ,
+ 'commit' => 'Next',
+ 'suggested_deployable_id' => "other"},
+ returns => '200',
+ #contains => "//html/body//li[text() = 'Provider added.']",
+ follow => true,
+ use_cookies_at => '/tmp/aeolus-admin',
+ #unless => { 'get' =>
'https://localhost/conductor/providers',
+ # 'contains' => "//html/body//a[text() =
'$name']" },
+ require => Exec["build-$name-image"]
+ }
+
+ #web_request{ "launch-deployment-$name":
+ # post => "https://localhost/conductor/deployments/new",
+ # parameters => { 'deployable_name' => $name },
+ # returns => '200',
+ # #contains => "//html/body//li[text() = 'Provider added.']",
+ # follow => true,
+ # use_cookies_at => '/tmp/aeolus-admin',
+ # #unless => { 'get' =>
'https://localhost/conductor/providers',
+ # # 'contains' => "//html/body//a[text() =
'$name']" },
+ # require => Web_request["deployment-$name"]
+ #}
+}
--
1.7.4.4