Refactor of example site.pp
This commit refactors the previous site.pp example. Adds ring building types and removes the ringbuilding file. Remove unnessary comments. Adds requirement that swift proxy is only configured after the ring is built.
This commit is contained in:
@@ -29,72 +29,77 @@ node pre_swift {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node swift_all {
|
node swift_all {
|
||||||
# install curl (we will need it for testing)
|
|
||||||
package { 'curl': ensure => present }
|
package { 'curl': ensure => present }
|
||||||
|
|
||||||
# ensure that sshd is installed
|
|
||||||
class { 'ssh::server::install': }
|
class { 'ssh::server::install': }
|
||||||
|
|
||||||
# install memcached for the proxy
|
|
||||||
class { 'memcached':
|
class { 'memcached':
|
||||||
listen_ip => $proxy_local_net_ip,
|
listen_ip => $proxy_local_net_ip,
|
||||||
}
|
}
|
||||||
|
|
||||||
# set up the swift base deps
|
|
||||||
class { 'swift':
|
class { 'swift':
|
||||||
# not sure how I want to deal with this shared secret
|
# not sure how I want to deal with this shared secret
|
||||||
swift_hash_suffix => $swift_shared_secret,
|
swift_hash_suffix => $swift_shared_secret,
|
||||||
package_ensure => latest,
|
package_ensure => latest,
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure base deps for storage
|
|
||||||
class { 'swift::storage': }
|
|
||||||
|
|
||||||
# set up three loopback devices for testing
|
|
||||||
swift::storage::loopback { ['1', '2', '3']:
|
swift::storage::loopback { ['1', '2', '3']:
|
||||||
require => Class['swift'],
|
require => Class['swift'],
|
||||||
}
|
}
|
||||||
|
|
||||||
# this is just here temporarily until I can better figure out how to model it
|
Ring_object_device { weight => 1 }
|
||||||
file { '/etc/swift/ringbuilder.sh':
|
Ring_container_device { weight => 1 }
|
||||||
content => '
|
Ring_account_device { weight => 1 }
|
||||||
#!/bin/bash
|
|
||||||
# sets up a basic ring-builder
|
|
||||||
# which is hard-coded to only work
|
|
||||||
# for this example
|
|
||||||
|
|
||||||
cd /etc/swift
|
ring_object_device { '127.0.0.1:6010':
|
||||||
|
zone => 1,
|
||||||
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
|
device_name => '1',
|
||||||
|
}
|
||||||
swift-ring-builder object.builder create 18 3 1
|
ring_object_device { '127.0.0.1:6020':
|
||||||
swift-ring-builder object.builder add z1-127.0.0.1:6010/1 1
|
zone => 2,
|
||||||
swift-ring-builder object.builder add z2-127.0.0.1:6020/2 1
|
device_name => '2',
|
||||||
swift-ring-builder object.builder add z3-127.0.0.1:6030/3 1
|
}
|
||||||
swift-ring-builder object.builder rebalance
|
ring_object_device { '127.0.0.1:6030':
|
||||||
swift-ring-builder container.builder create 18 3 1
|
zone => 3,
|
||||||
swift-ring-builder container.builder add z1-127.0.0.1:6011/1 1
|
device_name => '3',
|
||||||
swift-ring-builder container.builder add z2-127.0.0.1:6021/2 1
|
|
||||||
swift-ring-builder container.builder add z3-127.0.0.1:6031/3 1
|
|
||||||
swift-ring-builder container.builder rebalance
|
|
||||||
swift-ring-builder account.builder create 18 3 1
|
|
||||||
swift-ring-builder account.builder add z1-127.0.0.1:6012/1 1
|
|
||||||
swift-ring-builder account.builder add z2-127.0.0.1:6022/2 1
|
|
||||||
swift-ring-builder account.builder add z3-127.0.0.1:6032/3 1
|
|
||||||
swift-ring-builder account.builder rebalance
|
|
||||||
',
|
|
||||||
mode => '555',
|
|
||||||
}~>
|
|
||||||
# TODO - figure out why this is failing ;(
|
|
||||||
exec { 'build-ring':
|
|
||||||
command => '/etc/swift/ringbuilder.sh',
|
|
||||||
refreshonly => true,
|
|
||||||
notify => Service['swift-proxy']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure swift proxy after the run is build
|
ring_container_device { '127.0.0.1:6011':
|
||||||
|
zone => 1,
|
||||||
|
device_name => '1',
|
||||||
|
}
|
||||||
|
ring_container_device { '127.0.0.1:6021':
|
||||||
|
zone => 2,
|
||||||
|
device_name => '2',
|
||||||
|
}
|
||||||
|
ring_container_device { '127.0.0.1:6031':
|
||||||
|
zone => 3,
|
||||||
|
device_name => '3',
|
||||||
|
}
|
||||||
|
|
||||||
|
ring_account_device { '127.0.0.1:6012':
|
||||||
|
zone => 1,
|
||||||
|
device_name => '1',
|
||||||
|
}
|
||||||
|
ring_account_device { '127.0.0.1:6022':
|
||||||
|
zone => 2,
|
||||||
|
device_name => '2',
|
||||||
|
}
|
||||||
|
ring_account_device { '127.0.0.1:6032':
|
||||||
|
zone => 3,
|
||||||
|
device_name => '3',
|
||||||
|
}
|
||||||
|
|
||||||
|
class { 'swift::ringbuilder':
|
||||||
|
part_power => '18',
|
||||||
|
replicas => '3',
|
||||||
|
min_part_hours => 1,
|
||||||
|
require => Class['swift'],
|
||||||
|
}
|
||||||
|
|
||||||
|
class { 'swift::storage': }
|
||||||
|
|
||||||
|
# TODO should I enable swath in the default config?
|
||||||
class { 'swift::proxy':
|
class { 'swift::proxy':
|
||||||
account_autocreate => true,
|
account_autocreate => true,
|
||||||
|
require => Class['swift::ringbuilder'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user