From 9da000c6511e85e030e431b7d951d325c2c98681 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 2 Oct 2013 10:28:01 +0200 Subject: Improve the overall experience of the module. - Extending the README - Add a trocla::yaml class for a simple quickstart. - Fixes issues: #4 & #5 --- Modulefile | 2 +- README | 7 ------- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ manifests/config.pp | 26 +++++++++++++++++--------- manifests/dependencies.pp | 12 ++++++++++++ manifests/master.pp | 17 ++++++++--------- manifests/master/ree.pp | 3 ++- manifests/yaml.pp | 22 ++++++++++++++++++++++ templates/troclarc.yaml.erb | 8 +++++--- 9 files changed, 110 insertions(+), 30 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100644 manifests/dependencies.pp create mode 100644 manifests/yaml.pp diff --git a/Modulefile b/Modulefile index 792c689..b83e308 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'duritong-trocla' -version '0.0.2' +version '0.0.3' author 'duritong' license '' diff --git a/README b/README deleted file mode 100644 index f51c4de..0000000 --- a/README +++ /dev/null @@ -1,7 +0,0 @@ -trocla - -This is the trocla module. It provides the necessary function to query -trocla from puppet, as well as a puppet class to setup things on the -puppetmaster. - -For more information about trocla visit: https://github.com/duritong/trocla diff --git a/README.md b/README.md new file mode 100644 index 0000000..64dd756 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# trocla + +This is the puppet module to manage a trocla installation on the puppet +master. It also, provides the necessary function to query trocla from puppet. + +To get a quick start you might be interested in using the `trocla::yaml` class +on your master. This will install trocla and setup it using the default YAML +storage backend for your master. There is no need to configure anything on the +clients if you do not want to use trocla on the clients itself. + +If you want to do your own very custom setup, you should look into the other +classes. + +## Other classes + +### trocla::config + +This is a class that manages a trocla configuration. You might use this +one if you do not use the default yaml setup. + +### trocla::master + +This class manages the installation of trocla itself. It will not configure +trocla, it will just install the necessary packages. + +### trocla::dependencies + +This class is used to install the necessary dependencies if you are not using +the rubygems module. See dependencies below for more information. + +## Dependencies + +By default this module requires the rubygems puppet module. If you want to +use trocla with ruby enterprise, you might be also interested in the +ruby_enterprise module. +If the dependencies should be managed internally, set: install_deps to `true`. + +You can also use this module with 0 dependencies by setting the option +use_rubygems to false. + +## Moar + +RTFC and for more information about trocla visit: https://github.com/duritong/trocla diff --git a/manifests/config.pp b/manifests/config.pp index ebae2f1..a3a6e01 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,18 +1,26 @@ #Installs configuration files for the trocla agent/CLI # #Options -# [*adapter*] Defines the adapter type to use for trocla agent. Generally YAML -# [*adapter_options*] This will contain a hash of the actual options to pass the -# trocla configuration. Generally you might pass the file option for key-file -# [*keysize*] Define the length of default passwords to create. 16 by default +# [*adapter*] Defines the adapter type to use for trocla agent. +# By default it's YAML +# [*adapter_options*] This will contain a hash of the adapter options to pass the +# trocla configuration. +# [*password_length*] Define the length of default passwords to create. 16 by default +# [*random_passwords*] Should trocla generate random passwords +# if none can be found. *true* by default. +# [*manage_dependencies*] Whether to manage the dependencies or not. Default *true* class trocla::config ( - $adapter = undef, - $keysize = 16, - $adapter_options = { 'default' => '' }, + $adapter = 'YAML', + $password_length = 16, + $random_passwords = true, + $adapter_options = {}, + $manage_dependencies = true, ) { - require trocla::master + if $manage_dependencies { + require trocla::master + } -# Deploy default config file and link it for trocla cli lookup + # Deploy default config file and link it for trocla cli lookup file{ "${settings::confdir}/troclarc.yaml": ensure => present, diff --git a/manifests/dependencies.pp b/manifests/dependencies.pp new file mode 100644 index 0000000..0b2bb73 --- /dev/null +++ b/manifests/dependencies.pp @@ -0,0 +1,12 @@ +class trocla::dependencies( + $provider = gem, +) { + package { 'moneta': + ensure => present, + provider => $provider, + } + package { 'highline': + ensure => present, + provider => $provider, + } +} diff --git a/manifests/master.pp b/manifests/master.pp index 64444b1..8bc5cd9 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -2,10 +2,14 @@ # # This module manages the necessary things for trocla on a master. # -# [Remember: No empty lines between comments and class definition] +# [*install_deps*]: Whether to directly install the necessary dependencies +# [*use_rubygems*]: Use the rubygems module to manage your dependencies +# [*provider*]: Which provider to use to install your dependencies, if you +# don't use the rubygems module class trocla::master ( $install_deps = false, $use_rubygems = true, + $provider = gem, ) { #Select if the upstream rubygems modules should be required for install @@ -16,20 +20,15 @@ class trocla::master ( #Manually install requirements via gem if $install_deps { - package { 'moneta': - ensure => present, - provider => gem, - } - package { 'highline': - ensure => present, - provider => gem, + class{'trocla::dependencies': + provider => $provider, } } #Main trocla install package {'trocla': ensure => present, - provider => gem, + provider => $provider, } } diff --git a/manifests/master/ree.pp b/manifests/master/ree.pp index c8d58f0..bf2c400 100644 --- a/manifests/master/ree.pp +++ b/manifests/master/ree.pp @@ -1,6 +1,7 @@ # Class: trocla::master::ree # -# This module manages the necessary things for trocla on a master. +# This module manages the necessary things for trocla on a master for +# RubyEnterprise installation. # # [Remember: No empty lines between comments and class definition] class trocla::master::ree { diff --git a/manifests/yaml.pp b/manifests/yaml.pp new file mode 100644 index 0000000..4650a5a --- /dev/null +++ b/manifests/yaml.pp @@ -0,0 +1,22 @@ +class trocla::yaml( + $password_length = 16 + $random_passwords = true, + $data_file = "{$settings::server_datadir}/trocla_data.yaml", +) { + + class{'trocla::config': + password_length => $password_length, + random_passwords => $random_passwords, + adapter => 'YAML', + adapter_options => { + file => $data_file, + }, + } + + file{$data_file: + ensure => file, + owner => puppet, + group => 0, + mode => 0600; + } +} diff --git a/templates/troclarc.yaml.erb b/templates/troclarc.yaml.erb index 3f473fe..d574cd9 100644 --- a/templates/troclarc.yaml.erb +++ b/templates/troclarc.yaml.erb @@ -1,9 +1,11 @@ --- options: - random: true - length: <%= @keysize %> + random: <%= @random_passwords %> + length: <%= @password_length %> adapter: :<%= @adapter %> +<% unless @adapter_options.empty? %> adapter_options: <% @adapter_options.each do |key,value| -%> - :<%= key -%>: '<%= value -%>' + :<%= key %>: '<%= value %>' +<% end -%> <% end -%> -- cgit v1.2.3