catfish 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b209bc38fa7845bde7d77a923adbc95afde6e6a
4
- data.tar.gz: 730626a1fde2ec8806945bfae9ae629133695b80
3
+ metadata.gz: bd4f16456fc2a0292aaa6f563b208221a7d773f1
4
+ data.tar.gz: 5427abeed216170b88c413e07c561bfed507579b
5
5
  SHA512:
6
- metadata.gz: 532e16b65a907c6b86cb9e780d429b75991988cf815d644cab49b248235f9209c7161b8f759fd71d1171c36f82cba39cefa563c82ee9b9650fb1d4ea74b8d178
7
- data.tar.gz: eae765e3a7a0ae3f15c1d8b6f087cb67238f270dee1d14f8b126b2635305573ab0ae9b60d68922f69312947bf20db4b9250a7382c07bd3a314cc3d6fac9d82ce
6
+ metadata.gz: 9d66e6106c7a1b0d6b3e3dc145fd1d5fe43e35a98f94d14c6c63e3289f46bf620a7b9883381950e43ed6d97d76f77936d735d063162f438afbfbad7de76cb26d
7
+ data.tar.gz: 8d57477e3863d3660c7d9804b8ec04ef0e8a4c272ebcdb7d5f291a58c97e767d5f66994184c7629363e5cdc88c8ba2b5a626407c2dec2776bbb9d58ee574b89d
data/.gitignore CHANGED
@@ -35,3 +35,6 @@ build/
35
35
 
36
36
  # vagrant
37
37
  .vagrant
38
+ .librarian
39
+ .tmp
40
+ modules/
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ notifications:
6
+ email:
7
+ - chris.baldauf@gmail.com
8
+ deploy:
9
+ provider: rubygems
10
+ on:
11
+ tags: true
12
+ api_key:
13
+ secure: rt3BC6VAszR2ZxjlEmW6AJiqDa/12GdY5KXL4VEXnagyIT9UEjCBHzaNdBTFeSagEskMlMxgNi/UCpGg8eWXbSoesIpFdVBo8W8drNDf13eCMgfJaI5TeWnc5DYRJEduXRNdWTmznUQ8DYZylExeTFKxAAZdiceGBq4bJGFtzc8=
data/README.md CHANGED
@@ -50,6 +50,16 @@ And you can even run the provisioning in parallel
50
50
 
51
51
  $ catfish provision --parallel
52
52
 
53
+ ### Plugins
54
+ You can have catfish ensure that vagrant plugins are installed via the 'plugin'
55
+ directive in your Catfishfile.
56
+
57
+ ```ruby
58
+ plugin 'vagrant-hostmaster'
59
+ ```
60
+
61
+ $ catfish plugin
62
+
53
63
  ### Getting help
54
64
 
55
65
  $ catfish help
@@ -57,7 +67,7 @@ And you can even run the provisioning in parallel
57
67
  ## TODO
58
68
 
59
69
  - Puppet provisioner support
60
- - Vagrant plugin support in Catfishfile
70
+ - Add some spec tests
61
71
 
62
72
  ## Contributing
63
73
 
data/Rakefile CHANGED
@@ -2,6 +2,9 @@ require 'bundler/gem_tasks'
2
2
  require 'rubocop/rake_task'
3
3
  require 'rake/clean'
4
4
 
5
- CLEAN.include('Catfishfile', 'Catfishfile.lock', 'Vagrantfile')
5
+ CLEAN.include('Catfishfile', 'Catfishfile.lock', 'Vagrantfile', 'modules',
6
+ 'Puppetfile*', 'manifests', 'hiera.yaml', 'hiera')
6
7
 
7
8
  RuboCop::RakeTask.new
9
+
10
+ task default: :install
data/lib/catfish/cli.rb CHANGED
@@ -5,15 +5,6 @@ module Catfish
5
5
  class CLI < Thor
6
6
  include Thor::Actions
7
7
 
8
- # def self.start(*)
9
- # super
10
- # rescue Exception => e
11
- # Bundler.ui = UI::Shell.new
12
- # raise e
13
- # ensure
14
- # Bundler.cleanup
15
- # end
16
-
17
8
  def initialize(*args)
18
9
  super
19
10
  rescue UnknownArgumentError => e
@@ -32,11 +23,17 @@ module Catfish
32
23
  D
33
24
  method_option 'provisioners', type: :array, banner: 'A list of vagrant provisiners to use'
34
25
  method_option 'communicator', type: :string, banner: 'The communicator. ssh (default) or winrm'
26
+ method_option 'windows', type: :boolean, banner: 'Shorthand for --communicator=winrm'
35
27
  method_option 'winrm-username', type: :string, banner: 'Username for winrm. Used with --communicator=winrm'
36
28
  method_option 'winrm-password', type: :string, banner: 'Password for winrm. Used with --communicator=winrm'
29
+ method_option 'shell', type: :boolean, banner: 'Shorthand for provisioners=shell'
37
30
  method_option 'shell-paths', type: :array, banner: 'A list of paths to use if shell provisioning is selected'
38
31
  method_option 'ssh-username', type: :string, banner: 'SSH username'
39
32
  method_option 'ssh-private-key-path', type: :string, banner: 'Path to SSH private key'
33
+ method_option 'puppet', type: :boolean, banner: 'Shorthand for provisioners=puppet'
34
+ method_option 'puppet-librarian-puppet', type: :boolean, default: 'true',
35
+ banner: 'Whether or not to include a default Puppetfile and librarian puppet plugin'
36
+ method_option 'puppet-hiera', type: :boolean, default: 'true', banner: 'Include hiera templates. Only applies to puppet provisioner'
40
37
  method_option 'servers', type: :array, banner: 'Initial list of servers to include in Catfishfile'
41
38
  method_option 'plugins', type: :array, banner: 'Vagrant plugins to be installed'
42
39
  def init
@@ -1,3 +1,5 @@
1
+ require 'pp'
2
+
1
3
  module Catfish
2
4
  class CLI
3
5
  class Init
@@ -11,30 +13,50 @@ module Catfish
11
13
  def run
12
14
  p 'Initializing Catfish repository'
13
15
 
14
- templates = {
15
- 'Catfishfile.tt' => 'Catfishfile',
16
- 'Vagrantfile.tt' => 'Vagrantfile'
17
- }
16
+ provisioners = options[:provisioners] || []
17
+ plugins = options[:plugins] || []
18
+
19
+ # Shorthand aliases
20
+ options[:communicator] = 'winrm' if options[:windows]
21
+ provisioners << 'shell' if options[:shell]
22
+ provisioners << 'puppet' if options[:puppet]
23
+ plugins << 'vagrant-librarian-puppet' if options['puppet-librarian-puppet']
18
24
 
19
25
  opts = {
20
- provisioners: options[:provisioners] || [],
26
+ provisioners: provisioners || [],
21
27
  shell_paths: options['shell-paths'] || ['{{PATH_TO_YOUR_SCRIPT}}'],
28
+ puppet_hiera: options['puppet-hiera'],
29
+ puppet_librarian_puppet: options['puppet-librarian-puppet'],
22
30
  communicator: options[:communicator] || 'ssh',
23
31
  winrm_username: options['winrm-username'] || '{{YOUR_WINRM_USERNAME}}',
24
32
  winrm_password: options['winrm-password'] || '{{YOUR_WINRM_PASSWORD}}',
25
33
  ssh_username: options['ssh-username'] || '{{YOUR_SSH_USERNAME}}',
26
34
  ssh_private_key_path: options['ssh-private-key-path'] || '{{PATH_TO_YOUR_SSH_PRIVATE_KEY}}',
27
35
  servers: options['servers'] || [],
28
- plugins: options['plugins'] || []
36
+ plugins: plugins || []
37
+ }
38
+
39
+ templates = {
40
+ 'Catfishfile.tt' => 'Catfishfile',
41
+ 'Vagrantfile.tt' => 'Vagrantfile'
29
42
  }
30
43
 
44
+ if provisioners.include? 'puppet'
45
+ templates.merge!('puppet/manifests/default.pp.tt' => 'manifests/default.pp')
46
+ templates.merge!('puppet/Puppetfile.tt' => 'Puppetfile') if options['puppet-librarian-puppet']
47
+
48
+ if options['puppet-hiera']
49
+ templates.merge!('puppet/hiera.yaml.tt' => 'hiera.yaml')
50
+ templates.merge!('puppet/hiera/common.yaml.tt' => 'hiera/common.yaml')
51
+ end
52
+ end
53
+
31
54
  templates.each do |src, dst|
32
55
  thor.template(src, dst, opts)
33
56
  end
34
- p 'Repository initialized. Remember to:'
35
- p ' - Check your Vagrantfile and replace any placeholders'
36
- p ' - Edit your Catfish file and list target servers'
37
- p ' - Run catfish resolve'
57
+ puts 'Repository initialized. Remember to:'
58
+ puts ' - Check your Vagrantfile and replace any placeholders'
59
+ puts ' - Edit your Catfish file and list target servers'
38
60
  end
39
61
  end
40
62
  end
@@ -19,7 +19,7 @@ module Catfish
19
19
  abort 'ERROR DEPLOYING: One or more servers could not be connected to'
20
20
  end
21
21
 
22
- provision
22
+ provision status
23
23
 
24
24
  ensure
25
25
 
@@ -36,7 +36,7 @@ module Catfish
36
36
  fail "#{vagrant_version} or greater is a prerequisite" unless `vagrant --version`.include? vagrant_version
37
37
  end
38
38
 
39
- def provision
39
+ def provision(status)
40
40
  if options[:parallel]
41
41
  machines = status.split("\n").collect do |line|
42
42
  line.split(',')[1]
@@ -4,12 +4,20 @@
4
4
  Vagrant.configure("2") do |config|
5
5
 
6
6
  config.vm.box = "tknerr/managed-server-dummy"
7
- <% config[:provisioners].each do |provisioner| -%>
8
- <% if provisioner == 'shell' -%>
7
+ <% if config[:provisioners].include? 'shell' -%>
9
8
  <% config[:shell_paths].each do |path| -%>
10
9
  config.vm.provision 'shell', path: '<%= path %>'
11
10
  <% end -%>
12
11
  <% end -%>
12
+ <% if config[:provisioners].include? 'puppet' -%>
13
+ config.vm.provision 'puppet' do |puppet|
14
+ <% if config[:puppet_hiera] -%>
15
+ puppet.hiera_config_path = 'hiera.yaml'
16
+ <% end -%>
17
+ <% if config[:puppet_librarian_puppet] -%>
18
+ puppet.module_path = 'modules'
19
+ <% end -%>
20
+ end
13
21
  <% end -%>
14
22
  <% if config[:communicator] == 'winrm' -%>
15
23
  config.vm.communicator = '<%= config[:communicator] %>'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ #^syntax detection
3
+
4
+ forge "https://forgeapi.puppetlabs.com"
5
+
6
+ # A module from the Puppet Forge
7
+ # mod 'puppetlabs/stdlib'
@@ -0,0 +1,10 @@
1
+ ---
2
+ :backends:
3
+ - yaml
4
+
5
+ :hierarchy:
6
+ # - "node/%{::fqdn}"
7
+ - "common"
8
+
9
+ :yaml:
10
+ :datadir: '/vagrant/hiera'
@@ -0,0 +1,2 @@
1
+ ---
2
+ the_name: "Joey Joe Joe Junior Shabadoo"
@@ -0,0 +1,3 @@
1
+ # Your puppet code goes here.
2
+ $the_name = hiera('the_name', 'World')
3
+ notify { "Hello, ${the_name}. ":}
@@ -1,3 +1,3 @@
1
1
  module Catfish
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Baldauf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - .gitignore
78
78
  - .rubocop.yml
79
+ - .travis.yml
79
80
  - Gemfile
80
81
  - LICENSE
81
82
  - README.md
@@ -91,6 +92,10 @@ files:
91
92
  - lib/catfish/dsl.rb
92
93
  - lib/catfish/templates/Catfishfile.tt
93
94
  - lib/catfish/templates/Vagrantfile.tt
95
+ - lib/catfish/templates/puppet/Puppetfile.tt
96
+ - lib/catfish/templates/puppet/hiera.yaml.tt
97
+ - lib/catfish/templates/puppet/hiera/common.yaml.tt
98
+ - lib/catfish/templates/puppet/manifests/default.pp.tt
94
99
  - lib/catfish/version.rb
95
100
  homepage: https://github.com/chrisbaldauf/catfish
96
101
  licenses: