From 18d681943e05936b55e36185af9c63e41ee5f01b Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Mon, 13 Feb 2012 15:39:18 -0800 Subject: [PATCH] Add inline docs to manifests This commit adds some initial inline documentation of the manifests. It also performs some basic whitespace cleanup. --- examples/all.pp | 6 +++-- examples/pre.pp | 1 + manifests/init.pp | 21 +++++++++++++--- manifests/proxy.pp | 40 +++++++++++++++++++++++++++--- manifests/ringbuilder.pp | 25 ++++++++++++++++++- manifests/ringbuilder/create.pp | 32 ++++++++++++++++++++++++ manifests/ringbuilder/rebalance.pp | 8 ++++++ manifests/storage.pp | 19 +++++++++++++- 8 files changed, 141 insertions(+), 11 deletions(-) diff --git a/examples/all.pp b/examples/all.pp index b4645345..97148830 100644 --- a/examples/all.pp +++ b/examples/all.pp @@ -5,9 +5,11 @@ $proxy_local_net_ip='127.0.0.1' $swift_shared_secret='changeme' + Exec { logoutput => true } package { 'curl': ensure => present } + class { 'ssh::server::install': } class { 'memcached': @@ -20,12 +22,12 @@ class { 'swift': package_ensure => latest, } -# create xfs partitions on a loopback device and mount them +# create xfs partitions on a loopback device and mounts them swift::storage::loopback { ['1', '2', '3']: require => Class['swift'], } -# sets up a storage node which is composed of a single +# sets up storage nodes which is composed of a single # device that contains an endpoint for an object, account, and container Swift::Storage::Node { diff --git a/examples/pre.pp b/examples/pre.pp index 036c150d..6965ac79 100644 --- a/examples/pre.pp +++ b/examples/pre.pp @@ -16,6 +16,7 @@ apt::source { 'puppet': release => 'natty', key => '4BD6EC30', } + # install the latest version of Puppet package { 'puppet': ensure => latest, diff --git a/manifests/init.pp b/manifests/init.pp index e798c26e..c8d9dd03 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,12 +1,27 @@ # Install and configure base swift components +# # == Parameters # [*swift_hash_suffix*] string of text to be used # as a salt when hashing to determine mappings in the ring. -# This file should be the same on every node in the cluster! +# This file should be the same on every node in the cluster. # -# [*swift_ssh_key*] NOT YET IMPLEMENTED +# [*swift_ssh_key*] NOT YET IMPLEMENTED. I am not entirely sure what +# this key is intended to be used for. +# [*package_ensure*] The ensure state for the swift package. +# Optional. Defaults to present. +# +# == Dependencies +# +# Class['ssh::server::install'] +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. # - class swift( $swift_hash_suffix, # $swift_ssh_key, diff --git a/manifests/proxy.pp b/manifests/proxy.pp index 3df721a5..5b81597e 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -1,7 +1,39 @@ +# Installs and configures the swift proxy node. +# +# [*Parameters*] +# +# [*allow_account_management*] +# [*account_autocreate*] Rather accounts should automatically be created. +# I think this may be tempauth specific +# [*proxy_local_net_ip*] The address that the proxy will bind to. +# Optional. Defaults to 127.0.0.1 +# TODO - this default is probably not ideal +# [*proxy_port*] Port that the swift proxy service will bind to. +# Optional. Defaults to 11211 +# [*auth_type*] - Type of authorization to use. +# valid values are tempauth, swauth, and keystone. +# Optional. Defaults to tempauth. +# [*package_ensure*] Ensure state of the swift proxy package. +# Optional. Defaults to present. +# +# == sw auth specific configuration +# [*swauth_endpoint*] +# [*swauth_super_admin_user*] +# +# == Dependencies +# +# Class['memcached'] +# +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. # -# [*auth_type*] - specified the type of authorization to use. -# valid values are tempauth, swauth, and keystone. Optional -# Defaults to keystone class swift::proxy( # why did cloudbuilders default this to false? $allow_account_management = true, @@ -74,8 +106,8 @@ post-stop exec /usr/bin/swift-init proxy-server stop', service { 'swift-proxy': ensure => running, - enable => true, provider => 'upstart', + enable => true, subscribe => File['/etc/swift/proxy-server.conf'], } } diff --git a/manifests/ringbuilder.pp b/manifests/ringbuilder.pp index 0e1c48c3..50be84f5 100644 --- a/manifests/ringbuilder.pp +++ b/manifests/ringbuilder.pp @@ -1,5 +1,28 @@ +# Used to configure nodes that are responsible for managing swift rings. +# Rings are used to make decitions about how to map objects in the cluster # -# role for deploying +# Specifies the following relationship: +# Rings shoudl be created before any devices are added to them +# Rings should be rebalanced if anything changes +# == Parameters +# # TODO - I need to review the ringbuilder docs +# [*part_power*] +# [*replicas*] +# [*min_part_hours*] +# +# == Dependencies +# +# Class['swift'] +# +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. # class swift::ringbuilder( $part_power = undef, diff --git a/manifests/ringbuilder/create.pp b/manifests/ringbuilder/create.pp index 3ddec03b..f1ee9fa2 100644 --- a/manifests/ringbuilder/create.pp +++ b/manifests/ringbuilder/create.pp @@ -1,3 +1,35 @@ +# Creates a swift ring using ringbuilder. +# It creates the associated ring file as /etc/swift/${name}.builder +# It will not create a ring if the file already exists. +# +# == Parameters +# +# [*name*] The type of ring to create. Accepts object|container|account +# [*part_power*] Number of partitions in the ring. (specified as the power of 2) +# Optional. Defaults to 18 (2^18) +# [*replicas] Number of replicas to store. +# Optional. Defaults to 5 +# TODO should it default to 3? +# [*min_part_hours*] Time before a partition can be moved. +# Optional. Defaults to 1. +# TODO should it be 24? +# +# == Examples +# +# swift::ringbuilder::create { 'account': +# part_power => 19, +# replicas => 3, +# min_part_hours => 24, +# } +# +# == Authors +# +# Pupppetlabs +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. +# define swift::ringbuilder::create( $part_power = 18, $replicas = 5, diff --git a/manifests/ringbuilder/rebalance.pp b/manifests/ringbuilder/rebalance.pp index f1dc1794..13f3a1a3 100644 --- a/manifests/ringbuilder/rebalance.pp +++ b/manifests/ringbuilder/rebalance.pp @@ -1,3 +1,11 @@ +# Swift::Ring::Rebalance +# Reblances the specified ring. Assumes that the ring already exists +# and is stored at /etc/swift/${name}.builder +# +# == Parameters +# +# [*name*] Type of ring to rebalance. The ring file is assumed to be at the path +# /etc/swift/${name}.builder define swift::ringbuilder::rebalance() { validate_re($name, '^object|container|account$') diff --git a/manifests/storage.pp b/manifests/storage.pp index 5386ec23..c5fb0a53 100644 --- a/manifests/storage.pp +++ b/manifests/storage.pp @@ -1,5 +1,22 @@ +# Performs all global configuration required +# for creating a swift storage node. +# Includes: +# installing an rsync server +# installs storeage packages (object,account,containers) +# == Parameters +# [*storeage_local_net_ip*] +# [*package_ensure*] +# == Dependencies # -# class for building out a storage node +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. # class swift::storage( $package_ensure = 'present',