Permalink
Browse files

add config file for defaults

This commit adds a config file that can be used
to set user specific defaults.

Also updates the config file to remove my
specific option.
  • Loading branch information...
1 parent 7fca6c9 commit a6809bc3dd568631921bfa9c59dd3298f38ca21f Dan Bode committed Mar 24, 2012
View
@@ -3,12 +3,4 @@ puppet_run_type: apply
nodes:
- node_one:
create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- group: accessible
- install:
-
+ install:
@@ -3,20 +3,10 @@ puppet_run_type: apply
nodes:
- all:
create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- group: accessible
install:
install_puppet: false
git_repos:
git://github.com/bodepd/puppetlabs-devstack: /etc/puppet/modules/devstack
- git://github.com/puppetlabs/puppet-vcsrepo /etc/puppet/modules/vcsrepo
- git://github.com/puppetlabs/puppetlabs-git /etc/puppet/modules/git
+ git://github.com/puppetlabs/puppet-vcsrepo: /etc/puppet/modules/vcsrepo
+ git://github.com/puppetlabs/puppetlabs-git: /etc/puppet/modules/git
manifest: /etc/puppet/modules/devstack/examples/site.pp
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -3,19 +3,9 @@ puppet_run_type: apply
nodes:
- glance_single:
create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- group: accessible
install:
git_repos:
git://github.com/puppetlabs/puppet-apt: /etc/puppet/modules/apt
git://github.com/bodepd/puppetlabs-ruby: /etc/puppet/modules/ruby
git://github.com/bodepd/puppetlabs-glance: /etc/puppet/modules/glance
manifest: /etc/puppet/modules/glance/examples/all.pp
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -3,23 +3,13 @@ puppet_run_type: apply
nodes:
- keystone:
create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- group: accessible
install:
install_puppet: false
git_repos:
- git@github.com:bodepd/puppetlabs-keystone: /etc/puppet/modules/keystone
+ gi://github.com/bodepd/puppetlabs-keystone: /etc/puppet/modules/keystone
git://github.com/puppetlabs/puppet-apt: /etc/puppet/modules/apt
git://github.com/puppetlabs/puppetlabs-mysql: /etc/puppet/modules/mysql
git://github.com/puppetlabs/puppetlabs-stdlib: /etc/puppet/modules/stdlib
git_checkout:
/etc/puppet/modules/keystone: dev
- #manifest: /etc/puppet/modules/nova/examples/site.pp
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
+ manifest: /etc/puppet/modules/keystone/examples/site.pp
@@ -0,0 +1,16 @@
+# this creates the new image to build
+puppet_run_type: apply
+nodes:
+ - keystone:
+ create:
+ install:
+ install_puppet: false
+ git_repos:
+ git://github.com/bodepd/puppetlabs-keystone: /etc/puppet/modules/keystone
+ git://github.com/puppetlabs/puppet-apt: /etc/puppet/modules/apt
+ git://github.com/puppetlabs/puppetlabs-mysql: /etc/puppet/modules/mysql
+ git://github.com/puppetlabs/puppet-concat: /etc/puppet/modules/concat
+ git://github.com/puppetlabs/puppetlabs-stdlib: /etc/puppet/modules/stdlib
+ git_checkout:
+ /etc/puppet/modules/keystone: dev
+ manifest: /etc/puppet/modules/keystone/examples/site.pp
@@ -1,19 +1,5 @@
# this creates the new image to build
puppet_run_type: apply
-defaults:
- create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- # TODO this group had to be created
- group: accessible
- install:
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
nodes:
- master_node:
create:
@@ -3,17 +3,8 @@ puppet_run_type: apply
defaults:
create:
options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- # TODO this group had to be created
- group: accessible
install:
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
master:
master_node:
master_type: pe_master
View
@@ -4,21 +4,11 @@ nodes:
- mysql:
create:
options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- group: accessible
install:
git_repos:
git://github.com/puppetlabs/mysql: /etc/puppet/modules/mysql
manifest: /etc/puppet/modules/swift/examples/all.pp
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
test:
command: ruby /etc/puppet/modules/swift/ext/swift.rb
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -4,12 +4,6 @@ nodes:
- node_one:
create:
options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- group: accessible
install:
git_repos:
git://github.com/puppetlabs/puppet-apt: /etc/puppet/modules/apt
@@ -20,10 +14,6 @@ nodes:
git://github.com/puppetlabs/puppetlabs-swift: /etc/puppet/modules/swift
manifest: /etc/puppet/modules/swift/examples/all.pp
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
test:
command: ruby /etc/puppet/modules/swift/ext/swift.rb
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -4,12 +4,6 @@ nodes:
- all:
create:
options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- group: accessible
install:
install_puppet: false
git_repos:
@@ -26,5 +20,3 @@ nodes:
/etc/puppet/modules/keystone: dev
manifest: /etc/puppet/modules/nova/examples/site.pp
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -4,17 +4,8 @@ puppet_run_type: apply
master:
master:
create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- group: accessible
install:
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
git_repos:
git://github.com/bodepd/puppetlabs-puppet: /etc/puppet/modules/puppet
git://github.com/bodepd/puppetlabs-passenger: /etc/puppet/modules/passenger
@@ -4,12 +4,6 @@ nodes:
- rabbitmq_server:
create:
options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-e434b9d4
- region: us-west-2
- type: m1.small
- group: accessible
install:
install_puppet: false
git_repos:
@@ -19,5 +13,3 @@ nodes:
git_checkout:
/etc/puppet/modules/rabbitmq: dev
options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
@@ -1,19 +1,6 @@
# this creates the new image to build
puppet_run_type: agent
defaults:
- create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- # TODO this group had to be created
- group: accessible
- install:
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
master:
master_node:
master_type: pe_master
@@ -1,19 +1,5 @@
# this creates the new image to build
puppet_run_type: agent
-defaults:
- create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- # TODO this group had to be created
- group: accessible
- install:
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
master:
ec2-50-112-47-38.us-west-2.compute.amazonaws.com:
install:
@@ -1,19 +1,5 @@
# this creates the new image to build
puppet_run_type: agent
-defaults:
- create:
- options:
- keyname: dans_keys
- # EBS backed 32 bit oneiric in us-west-2
- image: ami-8226abb2
- region: us-west-2
- type: m1.small
- # TODO this group had to be created
- group: accessible
- install:
- options:
- keyfile: ~/.ssh/dans_keys.pem
- login: ubuntu
master:
master_node:
create:
View
@@ -235,15 +235,15 @@ def self.process_config(config_hash)
def self.get_defaults(config_hash)
# TODO - the user should be able to supply their defaults
- defaults = {}
- if(config_hash['defaults'])
- Puppet.debug('Getting defaults')
- ['create', 'install'].each do |d|
- defaults[d]= config_hash['defaults'][d] || {}
- end
- else
- Puppet.debug("No defaults specified")
- defaults = {'create' => {}, 'install' => {}}
+ stack_conf_file = File.join(get_puppet_path, 'stack_builder.yaml')
+ defaults = File.exists?(stack_conf_file) ?
+ (YAML.load_file(stack_conf_file) || {}) : {}
+ config_hash['defaults'] ||= {}
+ Puppet.debug('Getting defaults')
+ ['create', 'install'].each do |d|
+ defaults[d] ||= {}
+ config_hash['defaults'][d] ||= {}
+ defaults[d]['options'] = (defaults[d]['options'] || {}).merge(config_hash['defaults'][d]['options'] || {})
end
defaults
end
@@ -323,8 +323,12 @@ def self.install_instances(nodes, dns_hash, mode, master = nil)
# returns the path where install scripts are located
# this is here in part for mocking out the path where
# sripts are loaded from
+ def self.get_puppet_path
+ File.expand_path(File.join('~', '.puppet'))
+ end
+
def self.get_stack_path
- File.expand_path(File.join('~', '.puppet', 'stacks'))
+ File.join(get_puppet_path, 'stacks')
end
def self.script_file_name(hostname)
Oops, something went wrong.

0 comments on commit a6809bc

Please sign in to comment.