2012-01-27 22:11:27 -08:00
|
|
|
#
|
|
|
|
# Example file for building out a multi-node environment
|
|
|
|
#
|
|
|
|
|
|
|
|
# for this to work, you need to run the nodes in this order:
|
|
|
|
|
|
|
|
#
|
|
|
|
# 1. storage nodes
|
|
|
|
# 2. ringbuilder
|
|
|
|
# 3. run the storage nodes again
|
|
|
|
# 4. run the proxy
|
|
|
|
# 5. test that everything works!!
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This example file is almost the
|
|
|
|
# same as what I have been using
|
|
|
|
# to build swift in my environment (which is based on vagrant)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$swift_shared_secret='changeme'
|
2012-02-13 15:41:12 -08:00
|
|
|
$swift_local_net_ip = $ipaddress_eth1
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
Exec { logoutput => true }
|
|
|
|
|
2012-02-14 14:11:27 -08:00
|
|
|
node 'swift_storage_1' {
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
$swift_zone = 1
|
|
|
|
include role_swift_storage
|
|
|
|
|
2012-02-14 14:11:27 -08:00
|
|
|
}
|
|
|
|
node 'swift_storage_2' {
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
$swift_zone = 2
|
|
|
|
include role_swift_storage
|
|
|
|
|
2012-02-14 14:11:27 -08:00
|
|
|
}
|
|
|
|
node 'swift_storage_3' {
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
$swift_zone = 3
|
|
|
|
include role_swift_storage
|
|
|
|
|
|
|
|
|
|
|
|
include role_swift_proxy
|
2012-02-14 14:11:27 -08:00
|
|
|
}
|
2012-01-27 22:11:27 -08:00
|
|
|
|
2012-02-14 14:11:27 -08:00
|
|
|
node 'swift_proxy' {
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
include role_swift_ringbuilder
|
|
|
|
|
2012-02-14 14:11:27 -08:00
|
|
|
}
|
2012-02-13 15:43:43 -08:00
|
|
|
|
|
|
|
class role_puppetmaster {
|
2012-02-14 14:11:27 -08:00
|
|
|
node 'swift_ringbuilding' {
|
2012-02-13 15:43:43 -08:00
|
|
|
|
|
|
|
class { 'mysql::server':
|
|
|
|
config_hash => {'bind_address' => '127.0.0.1'}
|
|
|
|
}
|
|
|
|
class { 'mysql::ruby': }
|
|
|
|
package { 'activerecord':
|
|
|
|
ensure => '2.3.5',
|
|
|
|
provider => 'gem',
|
|
|
|
}
|
|
|
|
|
|
|
|
class { 'puppet::master':
|
|
|
|
modulepath => '/vagrant/modules',
|
|
|
|
manifest => '/vagrant/manifests/site.pp',
|
|
|
|
storeconfigs => true,
|
|
|
|
storeconfigs_dbuser => 'dan',
|
|
|
|
storeconfigs_dbpassword => 'foo',
|
|
|
|
storeconfigs_dbadapter => 'mysql',
|
|
|
|
storeconfigs_dbserver => 'localhost',
|
|
|
|
storeconfigs_dbsocket => '/var/run/mysqld/mysqld.sock',
|
|
|
|
version => installed,
|
|
|
|
puppet_master_package => 'puppet',
|
|
|
|
autosign => 'true',
|
|
|
|
certname => $clientcert,
|
|
|
|
}
|
2012-01-27 22:11:27 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
class role_swift {
|
|
|
|
|
|
|
|
class { 'ssh::server::install': }
|
|
|
|
|
|
|
|
class { 'swift':
|
|
|
|
# not sure how I want to deal with this shared secret
|
|
|
|
swift_hash_suffix => $swift_shared_secret,
|
|
|
|
package_ensure => latest,
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-02-13 17:02:21 -08:00
|
|
|
class role_swift_ringbuilder inherits role_swift {
|
|
|
|
|
|
|
|
# collect all resource that we need to rebalance the ring
|
|
|
|
Ring_object_device <<| |>>
|
|
|
|
Ring_container_device <<| |>>
|
|
|
|
Ring_account_device <<| |>>
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
class { 'swift::ringbuilder':
|
|
|
|
part_power => '18',
|
|
|
|
replicas => '3',
|
|
|
|
min_part_hours => 1,
|
|
|
|
require => Class['swift'],
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class role_swift_proxy inherits role_swift {
|
|
|
|
|
|
|
|
package { 'curl': ensure => present }
|
|
|
|
|
|
|
|
class { 'memcached':
|
|
|
|
listen_ip => $proxy_local_net_ip,
|
|
|
|
}
|
|
|
|
|
2012-02-13 17:00:26 -08:00
|
|
|
class { 'swift::ringbuilder':
|
|
|
|
part_power => '18',
|
|
|
|
replicas => '3',
|
|
|
|
min_part_hours => 1,
|
|
|
|
require => Class['swift'],
|
|
|
|
}
|
2012-01-27 22:11:27 -08:00
|
|
|
# TODO should I enable swath in the default config?
|
|
|
|
class { 'swift::proxy':
|
|
|
|
account_autocreate => true,
|
|
|
|
require => Class['swift::ringbuilder'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class role_swift_storage inherits role_swift {
|
|
|
|
|
2012-02-13 16:50:41 -08:00
|
|
|
class { 'swift::storage':
|
|
|
|
storage_local_net_ip => $swift_local_net_ip,
|
|
|
|
}
|
2012-01-27 22:11:27 -08:00
|
|
|
|
|
|
|
# create xfs partitions on a loopback device and mount them
|
|
|
|
swift::storage::loopback { '1':
|
2012-02-13 16:50:41 -08:00
|
|
|
base_dir => '/srv/loopback-device',
|
|
|
|
mnt_base_dir => '/srv/node',
|
|
|
|
require => Class['swift'],
|
2012-01-27 22:11:27 -08:00
|
|
|
}
|
|
|
|
|
2012-02-13 16:50:41 -08:00
|
|
|
Swift::Storage::Device {
|
2012-01-27 22:11:27 -08:00
|
|
|
storage_local_net_ip => $swift_local_net_ip,
|
2012-02-13 16:50:41 -08:00
|
|
|
devices => '/srv/node',
|
2012-01-27 22:11:27 -08:00
|
|
|
}
|
2012-02-13 16:50:41 -08:00
|
|
|
|
|
|
|
swift::storage::device { '8001': type => 'object',}
|
|
|
|
@@ring_object_device { "${swift_local_net_ip}:8001":
|
|
|
|
zone => 1,
|
|
|
|
device_name => 1,
|
2012-01-27 22:11:27 -08:00
|
|
|
weight => 1,
|
|
|
|
}
|
2012-02-13 16:50:41 -08:00
|
|
|
|
|
|
|
swift::storage::device { '8002': type => 'container',}
|
|
|
|
@@ring_container_device { "${swift_local_net_ip}:8002":
|
|
|
|
zone => 1,
|
|
|
|
device_name => 1,
|
|
|
|
weight => 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
swift::storage::device { '8003': type => 'account',}
|
|
|
|
@@ring_account_device { "${swift_local_net_ip}:8003":
|
|
|
|
zone => 1,
|
|
|
|
device_name => 1,
|
2012-01-27 22:11:27 -08:00
|
|
|
weight => 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|