bebox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +78 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +163 -0
- data/LICENSE +21 -0
- data/README.md +372 -0
- data/Rakefile +8 -0
- data/bebox.gemspec +40 -0
- data/bin/bebox +5 -0
- data/lib/bebox/cli.rb +42 -0
- data/lib/bebox/commands/commands_helper.rb +33 -0
- data/lib/bebox/commands/environment_commands.rb +46 -0
- data/lib/bebox/commands/general_commands.rb +24 -0
- data/lib/bebox/commands/node_commands.rb +68 -0
- data/lib/bebox/commands/prepare_commands.rb +59 -0
- data/lib/bebox/commands/project_commands.rb +44 -0
- data/lib/bebox/commands/provision_commands.rb +145 -0
- data/lib/bebox/environment.rb +114 -0
- data/lib/bebox/logger.rb +51 -0
- data/lib/bebox/node.rb +308 -0
- data/lib/bebox/profile.rb +102 -0
- data/lib/bebox/project.rb +259 -0
- data/lib/bebox/provision.rb +257 -0
- data/lib/bebox/role.rb +103 -0
- data/lib/bebox/version.rb +3 -0
- data/lib/bebox/wizards/environment_wizard.rb +45 -0
- data/lib/bebox/wizards/node_wizard.rb +163 -0
- data/lib/bebox/wizards/profile_wizard.rb +91 -0
- data/lib/bebox/wizards/project_wizard.rb +175 -0
- data/lib/bebox/wizards/provision_wizard.rb +80 -0
- data/lib/bebox/wizards/role_wizard.rb +97 -0
- data/lib/bebox.rb +2 -0
- data/lib/deb/puppet_3.6.0/augeas-lenses_0.10.0-0ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/debconf-utils_1.5.42ubuntu1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/facter_2.0.1-1puppetlabs1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/hiera_1.3.2-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas0_0.10.0-0ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libjson-ruby_1.6.3-1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libshadow-ruby1.8_1.4.1-8build1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet-common_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-json_1.6.3-1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-rgen_0.6.5-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/virt-what_1.11-1_amd64.deb +0 -0
- data/lib/templates/node/Vagrantfile.erb +18 -0
- data/lib/templates/node/deploy_vagrant_node.erb +3 -0
- data/lib/templates/node/node.yml.erb +3 -0
- data/lib/templates/node/prepared_node.yml.erb +4 -0
- data/lib/templates/node/provisioned_node.yml.erb +4 -0
- data/lib/templates/project/Capfile.erb +2 -0
- data/lib/templates/project/Gemfile.erb +5 -0
- data/lib/templates/project/config/deploy/environment.erb +40 -0
- data/lib/templates/project/config/deploy/vagrant.erb +42 -0
- data/lib/templates/project/config/deploy.erb +120 -0
- data/lib/templates/project/dot_bebox.erb +4 -0
- data/lib/templates/project/gitignore.erb +7 -0
- data/lib/templates/project/ubuntu_dependencies +10 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/manifests/init.pp +24 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/manifests/init.pp +22 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/manifests/init.pp +28 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/manifests/init.pp +27 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/manifests/init.pp +30 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/manifests/init.pp +20 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/manifests/init.pp +47 -0
- data/lib/templates/puppet/default_profiles/base/users/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/users/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_roles/fundamental/manifests/init.pp +16 -0
- data/lib/templates/puppet/default_roles/security/manifests/init.pp +17 -0
- data/lib/templates/puppet/default_roles/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/profiles/Puppetfile.erb +24 -0
- data/lib/templates/puppet/profiles/manifests/init.pp.erb +17 -0
- data/lib/templates/puppet/roles/manifests/init.pp.erb +14 -0
- data/lib/templates/puppet/step-0/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-0/hiera/data/common.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/environment.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/node.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-0/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-0/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +11 -0
- data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +70 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +7 -0
- data/lib/templates/puppet/step-0/modules/rbenv/README.md +173 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +22 -0
- data/lib/templates/puppet/step-0/modules/rbenv/TODO +10 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +36 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +48 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +102 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +31 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +25 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +29 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +55 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +40 -0
- data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +109 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +5 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +418 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +166 -0
- data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +19 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +11 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +1304 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +7 -0
- data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +18 -0
- data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +349 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +53 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +15 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +81 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +83 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +79 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +111 -0
- data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +5 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile +14 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +43 -0
- data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +34 -0
- data/lib/templates/puppet/step-0/modules/sudo/LICENSE +13 -0
- data/lib/templates/puppet/step-0/modules/sudo/Modulefile +9 -0
- data/lib/templates/puppet/step-0/modules/sudo/README.md +171 -0
- data/lib/templates/puppet/step-0/modules/sudo/Rakefile +1 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +98 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +97 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +115 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +81 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +30 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +17 -0
- data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +520 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +76 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +105 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +24 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +151 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +46 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +60 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +61 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +127 -0
- data/lib/templates/puppet/step-0/modules/sudo/metadata.json +59 -0
- data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +9 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/user.pp +50 -0
- data/lib/templates/puppet/step-1/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-1/hiera/data/common.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/environment.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/node.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-1/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/user.pp +49 -0
- data/lib/templates/puppet/step-2/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-2/hiera/data/common.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/environment.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/node.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-2/manifests/node.erb +3 -0
- data/lib/templates/puppet/step-2/manifests/site.pp.erb +10 -0
- data/lib/templates/puppet/step-3/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-3/hiera/data/common.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/environment.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/node.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-3/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-3/manifests/site.pp.erb +15 -0
- data/spec/environment_spec.rb +82 -0
- data/spec/factories/environment.rb +20 -0
- data/spec/factories/node.rb +22 -0
- data/spec/factories/profile.rb +10 -0
- data/spec/factories/project.rb +17 -0
- data/spec/factories/provision.rb +13 -0
- data/spec/factories/role.rb +9 -0
- data/spec/fixtures/Capfile.test +2 -0
- data/spec/fixtures/Gemfile.test +5 -0
- data/spec/fixtures/config/deploy/environment.test +35 -0
- data/spec/fixtures/config/deploy/production.test +35 -0
- data/spec/fixtures/config/deploy/staging.test +35 -0
- data/spec/fixtures/config/deploy/vagrant.test +37 -0
- data/spec/fixtures/config/deploy.test +120 -0
- data/spec/fixtures/dot_bebox.test.erb +4 -0
- data/spec/fixtures/dot_gitignore.test +8 -0
- data/spec/fixtures/node/Vagrantfile.test.erb +18 -0
- data/spec/fixtures/node/node_0.test.erb +3 -0
- data/spec/fixtures/node/prepared_node_0.test.erb +4 -0
- data/spec/fixtures/node/provisioned_node_0.test.erb +4 -0
- data/spec/fixtures/node/vagrant_deploy.test +38 -0
- data/spec/fixtures/puppet/hiera/data/node0.server1.test.yaml.test +4 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile.test +24 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile_with_modules.test +20 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init.pp.test +17 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init_with_content.pp.test +22 -0
- data/spec/fixtures/puppet/roles/manifests/init.pp.test +14 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/common.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/pname_env.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/common.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/pname_env.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-2/Puppetfile.test +6 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/common.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/pname_env.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node.pp.test +13 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-2/modules/profiles/manifests/test/profile_0.pp.test +17 -0
- data/spec/fixtures/puppet/steps/step-2/modules/roles/manifests/role_0.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/common.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/pname_env.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/ubuntu_dependencies.test +10 -0
- data/spec/node0.server1.test/prepare_phase_spec.rb +53 -0
- data/spec/node0.server1.test/provision_step_0_spec.rb +46 -0
- data/spec/node0.server1.test/provision_step_1_spec.rb +41 -0
- data/spec/node0.server1.test/provision_step_2_spec.rb +79 -0
- data/spec/node0.server1.test/provision_step_3_spec.rb +76 -0
- data/spec/node_role_spec.rb +20 -0
- data/spec/node_spec.rb +71 -0
- data/spec/node_wizard_spec.rb +22 -0
- data/spec/ordered_phases_spec.rb +55 -0
- data/spec/pre_prepare_spec.rb +78 -0
- data/spec/pre_provision_steps_spec.rb +40 -0
- data/spec/profile_spec.rb +70 -0
- data/spec/project_spec.rb +195 -0
- data/spec/project_wizard_spec.rb +51 -0
- data/spec/puppet_spec_helper.rb +15 -0
- data/spec/role_profiles_spec.rb +40 -0
- data/spec/role_spec.rb +56 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/config_specs.yaml.example +2 -0
- data/spec/vagrant_spec_helper.rb +15 -0
- metadata +625 -0
data/bin/bebox
ADDED
data/lib/bebox/cli.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'gli'
|
2
|
+
require 'highline/import'
|
3
|
+
require 'bebox/logger'
|
4
|
+
|
5
|
+
module Bebox
|
6
|
+
class Cli
|
7
|
+
include Bebox::Logger
|
8
|
+
|
9
|
+
attr_accessor :project_root
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
# add the GLI magic on to the Bebox::Cli instance
|
13
|
+
self.extend GLI::App
|
14
|
+
|
15
|
+
program_desc 'Create basic provisioning of remote servers.'
|
16
|
+
version Bebox::VERSION
|
17
|
+
|
18
|
+
if inside_project?
|
19
|
+
require 'bebox/commands/project_commands'
|
20
|
+
self.extend Bebox::ProjectCommands
|
21
|
+
else
|
22
|
+
require 'bebox/commands/general_commands'
|
23
|
+
self.extend Bebox::GeneralCommands
|
24
|
+
end
|
25
|
+
exit run(*args)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Search recursively for .bebox file to see
|
29
|
+
# if current directory is a bebox project or not
|
30
|
+
def inside_project?
|
31
|
+
project_found = false
|
32
|
+
cwd = Pathname(Dir.pwd)
|
33
|
+
home_directory = File.expand_path('~')
|
34
|
+
cwd.ascend do |current_path|
|
35
|
+
project_found = File.file?("#{current_path.to_s}/.bebox")
|
36
|
+
self.project_root = current_path.to_s if project_found
|
37
|
+
break if project_found || (current_path.to_s == home_directory)
|
38
|
+
end
|
39
|
+
project_found
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Bebox
|
2
|
+
module CommandsHelper
|
3
|
+
# Obtain the environment from command parameters or menu
|
4
|
+
def get_environment(options)
|
5
|
+
environment = options[:environment]
|
6
|
+
# Ask for environment of node if flag environment not set
|
7
|
+
environment ||= Bebox::EnvironmentWizard.new.choose_environment(Environment.list(project_root))
|
8
|
+
# Check environment existence
|
9
|
+
Bebox::Environment.environment_exists?(project_root, environment) ? (return environment) : exit_now!(error("The '#{environment}' environment does not exist."))
|
10
|
+
end
|
11
|
+
|
12
|
+
# Obtain the default environment for a project
|
13
|
+
def default_environment
|
14
|
+
environments = Bebox::Environment.list(project_root)
|
15
|
+
if environments.count > 0
|
16
|
+
return environments.include?('vagrant') ? 'vagrant' : environments.first
|
17
|
+
else
|
18
|
+
return ''
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Check if vagrant is installed on the machine
|
23
|
+
def vagrant_installed?
|
24
|
+
(`which vagrant`) == 'vagrant not found' ? false : true
|
25
|
+
end
|
26
|
+
|
27
|
+
# Check if the step argument is valid
|
28
|
+
def valid_step?(step)
|
29
|
+
steps = %w{step-0 step-1 step-2 step-3}
|
30
|
+
steps.include?(step)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Bebox
|
2
|
+
module EnvironmentCommands
|
3
|
+
|
4
|
+
def self.extended(base)
|
5
|
+
base.load_commands
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_commands
|
9
|
+
# Environment management phase commands
|
10
|
+
desc 'Manage environments for the project. The \'vagrant\', \'production\' and \'staging\' environments are present by default.'
|
11
|
+
command :environment do |environment_command|
|
12
|
+
# Environment list command
|
13
|
+
environment_command.desc 'list the remote environments in the project'
|
14
|
+
environment_command.command :list do |environment_list_command|
|
15
|
+
environment_list_command.action do |global_options,options,args|
|
16
|
+
require 'bebox/environment'
|
17
|
+
environments = Bebox::Environment.list(project_root)
|
18
|
+
title 'Current environments:'
|
19
|
+
environments.map{|environment| msg(environment)}
|
20
|
+
warn('There are not environments yet. You can create a new one with: \'bebox environment new\' command.') if environments.empty?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# Environment new command
|
24
|
+
environment_command.desc 'add a remote environment to the project'
|
25
|
+
environment_command.arg_name "[environment]"
|
26
|
+
environment_command.command :new do |environment_new_command|
|
27
|
+
environment_new_command.action do |global_options,options,args|
|
28
|
+
help_now!(error('You did not supply an environment')) if args.count == 0
|
29
|
+
require 'bebox/wizards/environment_wizard'
|
30
|
+
Bebox::EnvironmentWizard.new.create_new_environment(project_root, args.first)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# Environment remove command
|
34
|
+
environment_command.desc "remove a remote environment in the project"
|
35
|
+
environment_command.arg_name "[environment]"
|
36
|
+
environment_command.command :remove do |environment_remove_command|
|
37
|
+
environment_remove_command.action do |global_options,options,args|
|
38
|
+
help_now!(error('You did not supply an environment')) if args.count == 0
|
39
|
+
require 'bebox/wizards/environment_wizard'
|
40
|
+
Bebox::EnvironmentWizard.new.remove_environment(project_root, args.first)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Bebox
|
2
|
+
module GeneralCommands
|
3
|
+
|
4
|
+
def self.extended(base)
|
5
|
+
base.load_commands
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_commands
|
9
|
+
# Project creation phase command
|
10
|
+
desc 'Create a new bebox project through a simple wizard'
|
11
|
+
arg_name '[project_name]'
|
12
|
+
command :new do |project_command|
|
13
|
+
project_command.action do |global_options,options,args|
|
14
|
+
if args.count > 0
|
15
|
+
require 'bebox/wizards/project_wizard'
|
16
|
+
Bebox::ProjectWizard.new.create_new_project("bebox-#{args.first}")
|
17
|
+
else
|
18
|
+
help_now!(error('You did not supply a project name'))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'bebox/role'
|
2
|
+
require 'bebox/node'
|
3
|
+
|
4
|
+
module Bebox
|
5
|
+
module NodeCommands
|
6
|
+
|
7
|
+
def self.extended(base)
|
8
|
+
base.load_commands
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_commands
|
12
|
+
# Nodes management phase commands
|
13
|
+
desc 'Manage nodes for a environment in the project.'
|
14
|
+
command :node do |node_command|
|
15
|
+
# Node list command
|
16
|
+
node_command.flag :environment, :desc => 'Set the environment for nodes', default_value: default_environment
|
17
|
+
node_command.desc 'list the nodes in a environment'
|
18
|
+
node_command.command :list do |node_list_command|
|
19
|
+
node_list_command.switch :all
|
20
|
+
node_list_command.action do |global_options,options,args|
|
21
|
+
# Call to list nodes
|
22
|
+
environments = options[:all] ? Bebox::Environment.list(project_root) : [get_environment(options)]
|
23
|
+
environments.each do |environment|
|
24
|
+
nodes = Node.list(project_root, environment, 'nodes')
|
25
|
+
title "Nodes for '#{environment}' environment:"
|
26
|
+
nodes.map{|node| msg("#{node} (#{Bebox::Node.node_provision_state(project_root, environment, node)})")}
|
27
|
+
warn('There are not nodes yet in the environment. You can create a new one with: \'bebox node new\' command.') if nodes.empty?
|
28
|
+
end
|
29
|
+
linebreak
|
30
|
+
end
|
31
|
+
end
|
32
|
+
# Node new command
|
33
|
+
node_command.desc 'add a node to a environment'
|
34
|
+
node_command.command :new do |node_new_command|
|
35
|
+
node_new_command.action do |global_options,options,args|
|
36
|
+
environment = get_environment(options)
|
37
|
+
info "Environment: #{environment}"
|
38
|
+
require 'bebox/wizards/node_wizard'
|
39
|
+
Bebox::NodeWizard.new.create_new_node(project_root, environment)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# Node remove command
|
43
|
+
node_command.desc "remove a node in a environment"
|
44
|
+
node_command.command :remove do |node_remove_command|
|
45
|
+
node_remove_command.action do |global_options,options,args|
|
46
|
+
environment = get_environment(options)
|
47
|
+
info "Environment: #{environment}"
|
48
|
+
require 'bebox/wizards/node_wizard'
|
49
|
+
Bebox::NodeWizard.new.remove_node(project_root, environment, args.first)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
# These commands are available if there is at least one role and one node
|
53
|
+
if Bebox::Role.roles_count(project_root) > 0 && Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
|
54
|
+
# Associate node to role command
|
55
|
+
node_command.desc "Associate a node with a role in a environment"
|
56
|
+
node_command.command :set_role do |node_role_command|
|
57
|
+
node_role_command.action do |global_options,options,args|
|
58
|
+
environment = get_environment(options)
|
59
|
+
info "Environment: #{environment}"
|
60
|
+
require 'bebox/wizards/node_wizard'
|
61
|
+
Bebox::NodeWizard.new.set_role(project_root, environment)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Bebox
|
2
|
+
module PrepareCommands
|
3
|
+
|
4
|
+
def self.extended(base)
|
5
|
+
base.load_commands
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_commands
|
9
|
+
# Prepare nodes phase commands
|
10
|
+
desc 'Prepare the nodes for the environment.'
|
11
|
+
command :prepare do |prepare_command|
|
12
|
+
prepare_command.flag :environment, :desc => 'Set the environment of node', default_value: default_environment
|
13
|
+
prepare_command.action do |global_options,options,args|
|
14
|
+
environment = get_environment(options)
|
15
|
+
# Check if vagrant is installed
|
16
|
+
return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
|
17
|
+
title "Environment: #{environment}"
|
18
|
+
require 'bebox/wizards/node_wizard'
|
19
|
+
Bebox::NodeWizard.new.prepare(project_root, environment)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
# These commands are available if there are at least one node in the vagrant environment
|
23
|
+
if Bebox::Node.list(project_root, 'vagrant', 'prepared_nodes').count > 0
|
24
|
+
desc 'Halt the nodes for vagrant environment.'
|
25
|
+
command :vagrant_halt do |vagrant_halt_command|
|
26
|
+
vagrant_halt_command.action do |global_options,options,args|
|
27
|
+
# Check if vagrant is installed
|
28
|
+
return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
|
29
|
+
# List nodes in environment and notice message
|
30
|
+
nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
|
31
|
+
environment = 'vagrant'
|
32
|
+
title "Environment: #{environment}"
|
33
|
+
title 'Halting nodes:'
|
34
|
+
nodes.each{|node| msg(node.hostname)}
|
35
|
+
linebreak
|
36
|
+
# Halt vagrant nodes
|
37
|
+
Bebox::Node.halt_vagrant_nodes(project_root)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
desc 'Up the nodes for vagrant environment.'
|
41
|
+
command :vagrant_up do |vagrant_up_command|
|
42
|
+
vagrant_up_command.action do |global_options,options,args|
|
43
|
+
# Check if vagrant is installed
|
44
|
+
return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
|
45
|
+
# List nodes in environment and notice message
|
46
|
+
nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
|
47
|
+
environment = 'vagrant'
|
48
|
+
title "Environment: #{environment}"
|
49
|
+
title 'Running up nodes:'
|
50
|
+
nodes.each{|node| msg(node.hostname)}
|
51
|
+
linebreak
|
52
|
+
# Up vagrant nodes
|
53
|
+
Bebox::Node.up_vagrant_nodes(project_root)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'bebox/commands/commands_helper'
|
2
|
+
|
3
|
+
module Bebox
|
4
|
+
module ProjectCommands
|
5
|
+
|
6
|
+
include Bebox::CommandsHelper
|
7
|
+
|
8
|
+
def self.extended(base)
|
9
|
+
base.load_commands
|
10
|
+
end
|
11
|
+
|
12
|
+
def load_commands
|
13
|
+
require 'bebox/commands/environment_commands'
|
14
|
+
require 'bebox/environment'
|
15
|
+
self.extend Bebox::EnvironmentCommands
|
16
|
+
# This commands only run if there are environments configured
|
17
|
+
if Bebox::Environment.list(project_root).count > 0
|
18
|
+
require 'bebox/commands/node_commands'
|
19
|
+
self.extend Bebox::NodeCommands
|
20
|
+
# These commands are available if there are at least one node configured in the project
|
21
|
+
if Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
|
22
|
+
require 'bebox/commands/prepare_commands'
|
23
|
+
self.extend Bebox::PrepareCommands
|
24
|
+
# These commands are available if there are at least one prepared_node
|
25
|
+
if Bebox::Node.count_all_nodes_by_type(project_root, 'prepared_nodes') > 0
|
26
|
+
# load_provision_commands
|
27
|
+
require 'bebox/commands/provision_commands'
|
28
|
+
self.extend Bebox::ProvisionCommands
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
pre do |global_options,command,options,args|
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
post do |global_options,command,options,args|
|
37
|
+
end
|
38
|
+
|
39
|
+
on_error do |exception|
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'bebox/profile'
|
2
|
+
|
3
|
+
module Bebox
|
4
|
+
module ProvisionCommands
|
5
|
+
|
6
|
+
def self.extended(base)
|
7
|
+
base.load_commands
|
8
|
+
end
|
9
|
+
|
10
|
+
def load_commands
|
11
|
+
desc 'Apply the Puppet step for the nodes in a environment. (step-0: Fundamental, step-1: User layer, step-2: Service layer, step-3: Security layer)'
|
12
|
+
arg_name "[step]"
|
13
|
+
command :apply do |apply_command|
|
14
|
+
apply_command.switch :all, :desc => 'Apply all steps in sequence.', :negatable => false
|
15
|
+
apply_command.flag :environment, :desc => 'Set the environment of nodes', default_value: default_environment
|
16
|
+
apply_command.action do |global_options,options,args|
|
17
|
+
environment = get_environment(options)
|
18
|
+
title "Environment: #{environment}"
|
19
|
+
require 'bebox/wizards/provision_wizard'
|
20
|
+
if options[:all]
|
21
|
+
title "Provisioning all steps..."
|
22
|
+
Bebox::PROVISION_STEPS.each do |step|
|
23
|
+
title "Provisioning #{step}:"
|
24
|
+
Bebox::ProvisionWizard.new.apply_step(project_root, environment, step)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
step = args.first
|
28
|
+
help_now!(error('You did not specify an step')) if args.count == 0
|
29
|
+
help_now!(error('You did not specify a valid step')) unless valid_step?(step)
|
30
|
+
# Apply the step for the environment
|
31
|
+
title "Provisioning #{step}:"
|
32
|
+
Bebox::ProvisionWizard.new.apply_step(project_root, environment, step)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Profile commands
|
38
|
+
desc 'Manage profiles for the node provisioning phase.'
|
39
|
+
command :profile do |profile_command|
|
40
|
+
# Profile list command
|
41
|
+
profile_command.desc 'list the profiles in the project'
|
42
|
+
profile_command.command :list do |profile_list_command|
|
43
|
+
profile_list_command.action do |global_options,options,args|
|
44
|
+
require 'bebox/wizards/profile_wizard'
|
45
|
+
profiles = Bebox::ProfileWizard.new.list_profiles(project_root)
|
46
|
+
title 'Current profiles:'
|
47
|
+
profiles.map{|profile| msg(profile)}
|
48
|
+
warn('There are not profiles yet. You can create a new one with: \'bebox profile new\' command.') if profiles.empty?
|
49
|
+
linebreak
|
50
|
+
end
|
51
|
+
end
|
52
|
+
# Profile new command
|
53
|
+
profile_command.desc 'add a profile to the project'
|
54
|
+
profile_command.arg_name "[name]"
|
55
|
+
profile_command.command :new do |profile_new_command|
|
56
|
+
profile_new_command.flag :p, :arg_name => 'path', :desc => 'A relative path of the category folders tree to store the profile. Ex. basic/security/iptables'
|
57
|
+
profile_new_command.action do |global_options,options,args|
|
58
|
+
path = options[:p] || ''
|
59
|
+
help_now!(error('You did not supply a name')) if args.count == 0
|
60
|
+
require 'bebox/wizards/profile_wizard'
|
61
|
+
Bebox::ProfileWizard.new.create_new_profile(project_root, args.first, path)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
# Profile remove command
|
65
|
+
profile_command.desc "remove a profile from the project"
|
66
|
+
profile_command.command :remove do |profile_remove_command|
|
67
|
+
profile_remove_command.action do |global_options,options,args|
|
68
|
+
require 'bebox/wizards/profile_wizard'
|
69
|
+
Bebox::ProfileWizard.new.remove_profile(project_root)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Roles commands
|
75
|
+
desc 'Manage roles for the node provisioning phase.'
|
76
|
+
command :role do |role_command|
|
77
|
+
# Role list command
|
78
|
+
role_command.desc 'list the roles in the project'
|
79
|
+
role_command.command :list do |role_list_command|
|
80
|
+
role_list_command.action do |global_options,options,args|
|
81
|
+
roles = Bebox::Role.list(project_root)
|
82
|
+
title 'Current roles:'
|
83
|
+
roles.map{|role| msg(role)}
|
84
|
+
warn('There are not roles yet. You can create a new one with: \'bebox role new\' command.') if roles.empty?
|
85
|
+
linebreak
|
86
|
+
end
|
87
|
+
end
|
88
|
+
# Role new command
|
89
|
+
role_command.desc 'add a role to the project'
|
90
|
+
role_command.arg_name "[name]"
|
91
|
+
role_command.command :new do |role_new_command|
|
92
|
+
role_new_command.action do |global_options,options,args|
|
93
|
+
help_now!(error('You did not supply a name')) if args.count == 0
|
94
|
+
require 'bebox/wizards/role_wizard'
|
95
|
+
Bebox::RoleWizard.new.create_new_role(project_root, args.first)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
# Role remove command
|
99
|
+
role_command.desc "remove a role from the project"
|
100
|
+
role_command.command :remove do |role_remove_command|
|
101
|
+
role_remove_command.action do |global_options,options,args|
|
102
|
+
require 'bebox/wizards/role_wizard'
|
103
|
+
Bebox::RoleWizard.new.remove_role(project_root)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# These commands are available if there are at least one role and one profile
|
108
|
+
if Bebox::Role.roles_count(project_root) > 0 && Bebox::Profile.profiles_count(project_root) > 0
|
109
|
+
# Role list profiles command
|
110
|
+
role_command.desc 'list the profiles in a role'
|
111
|
+
role_command.arg_name "[role_name]"
|
112
|
+
role_command.command :list_profiles do |list_profiles_command|
|
113
|
+
list_profiles_command.action do |global_options,options,args|
|
114
|
+
help_now!(error('You did not supply a role name.')) if args.count == 0
|
115
|
+
role = args.first
|
116
|
+
require 'bebox/wizards/role_wizard'
|
117
|
+
exit_now!(error("The '#{role}' role does not exist.")) unless Bebox::RoleWizard.new.role_exists?(project_root, role)
|
118
|
+
profiles = Bebox::Role.list_profiles(project_root, role)
|
119
|
+
title "Current profiles in '#{role}' role:"
|
120
|
+
profiles.map{|profile| msg(profile)}
|
121
|
+
warn("There are not profiles in role '#{role}'. You can add a new one with: 'bebox role add_profile' command.") if profiles.empty?
|
122
|
+
linebreak
|
123
|
+
end
|
124
|
+
end
|
125
|
+
# Role add profile command
|
126
|
+
role_command.desc 'add a profile to a role'
|
127
|
+
role_command.command :add_profile do |add_profile_command|
|
128
|
+
add_profile_command.action do |global_options,options,args|
|
129
|
+
require 'bebox/wizards/role_wizard'
|
130
|
+
Bebox::RoleWizard.new.add_profile(project_root)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
# Role remove profile command
|
134
|
+
role_command.desc "remove a profile from a role"
|
135
|
+
role_command.command :remove_profile do |remove_profile_command|
|
136
|
+
remove_profile_command.action do |global_options,options,args|
|
137
|
+
require 'bebox/wizards/role_wizard'
|
138
|
+
Bebox::RoleWizard.new.remove_profile(project_root)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
require 'bebox/project'
|
3
|
+
|
4
|
+
module Bebox
|
5
|
+
class Environment
|
6
|
+
|
7
|
+
attr_accessor :name, :project_root
|
8
|
+
|
9
|
+
def initialize(name, project_root)
|
10
|
+
self.name = name
|
11
|
+
self.project_root = project_root
|
12
|
+
end
|
13
|
+
|
14
|
+
# Create all files and directories related to an environment
|
15
|
+
def create
|
16
|
+
create_checkpoints
|
17
|
+
create_capistrano_base
|
18
|
+
generate_deploy_file
|
19
|
+
generate_hiera_template
|
20
|
+
end
|
21
|
+
|
22
|
+
# Delete all files and directories related to an environment
|
23
|
+
def remove
|
24
|
+
remove_checkpoints
|
25
|
+
remove_capistrano_base
|
26
|
+
remove_deploy_file
|
27
|
+
remove_hiera_template
|
28
|
+
end
|
29
|
+
|
30
|
+
# Lists existing environments
|
31
|
+
def self.list(project_root)
|
32
|
+
Dir["#{project_root}/.checkpoints/*/*"].map { |f| File.basename(f) }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create checkpoints base directories
|
36
|
+
def create_checkpoints
|
37
|
+
`cd #{self.project_root} && mkdir -p .checkpoints/environments/#{self.name}/{nodes,prepared_nodes,steps}`
|
38
|
+
(0..3).each{|i| `cd #{self.project_root} && mkdir -p .checkpoints/environments/#{self.name}/steps/step-#{i}`}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Remove checkpoints base directories
|
42
|
+
def remove_checkpoints
|
43
|
+
`cd #{self.project_root} && rm -rf .checkpoints/environments/#{self.name}`
|
44
|
+
end
|
45
|
+
|
46
|
+
# Create capistrano base
|
47
|
+
def create_capistrano_base
|
48
|
+
# Create keys directory for environment
|
49
|
+
`cd #{self.project_root} && mkdir -p config/keys/environments/#{self.name}`
|
50
|
+
# Create ssh key for puppet user if environment is vagrant
|
51
|
+
generate_puppet_user_keys('vagrant') if self.name == 'vagrant'
|
52
|
+
end
|
53
|
+
|
54
|
+
# Remove capistrano base
|
55
|
+
def remove_capistrano_base
|
56
|
+
`cd #{self.project_root} && rm -rf config/keys/environments/#{self.name}`
|
57
|
+
end
|
58
|
+
|
59
|
+
# Generate the deploy file for the environment
|
60
|
+
def generate_deploy_file
|
61
|
+
template_name = (self.name == 'vagrant') ? 'vagrant' : "environment"
|
62
|
+
config_deploy_template = Tilt::ERBTemplate.new("#{templates_path}/project/config/deploy/#{template_name}.erb")
|
63
|
+
File.open("#{self.project_root}/config/deploy/#{self.name}.rb", 'w') do |f|
|
64
|
+
f.write config_deploy_template.render(nil, :nodes => nil, :environment => self.name)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Generate the hiera data template for the environment
|
69
|
+
def generate_hiera_template
|
70
|
+
ssh_key = Bebox::Project.public_ssh_key_from_file(self.project_root, self.name)
|
71
|
+
project_name = Bebox::Project.shortname_from_file(self.project_root)
|
72
|
+
Bebox::PROVISION_STEPS.each do |step|
|
73
|
+
step_dir = Bebox::Provision.step_name(step)
|
74
|
+
hiera_template = Tilt::ERBTemplate.new("#{templates_path}/puppet/#{step}/hiera/data/environment.yaml.erb")
|
75
|
+
File.open("#{self.project_root}/puppet/steps/#{step_dir}/hiera/data/#{self.name}.yaml", 'w') do |f|
|
76
|
+
f.write hiera_template.render(nil, :step_dir => step_dir, :ssh_key => ssh_key, :project_name => project_name)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Remove the deploy file for the environment
|
82
|
+
def remove_deploy_file
|
83
|
+
`cd #{self.project_root} && rm -rf config/deploy/#{self.name}.rb`
|
84
|
+
end
|
85
|
+
|
86
|
+
# Remove the hiera data template file for the environment
|
87
|
+
def remove_hiera_template
|
88
|
+
Bebox::PROVISION_STEP_NAMES.each {|step| `cd #{self.project_root} && rm -rf puppet/steps/#{step}/hiera/data/#{self.name}.yaml` }
|
89
|
+
end
|
90
|
+
|
91
|
+
# Path to the templates directory in the gem
|
92
|
+
def templates_path
|
93
|
+
# File.expand_path(File.join(File.dirname(__FILE__), "..", "gems/bundler/lib/templates"))
|
94
|
+
File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')
|
95
|
+
end
|
96
|
+
|
97
|
+
# Generate ssh keys for connection with puppet user in environment
|
98
|
+
def generate_puppet_user_keys(environment)
|
99
|
+
`rm -f #{self.project_root}/config/keys/environments/#{environment}/{id_rsa,id_rsa.pub}`
|
100
|
+
`cd #{self.project_root}/config/keys/environments/#{environment} && ssh-keygen -q -f id_rsa -t rsa -N ''`
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check if the environment has ssh keys configured
|
104
|
+
def self.check_environment_access(project_root, environment)
|
105
|
+
key_exist = File.exist?("#{project_root}/config/keys/environments/#{environment}/id_rsa")
|
106
|
+
key_exist &&= File.exist?("#{project_root}/config/keys/environments/#{environment}/id_rsa.pub")
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check if there's an existing environment in the project
|
110
|
+
def self.environment_exists?(project_root, environment_name)
|
111
|
+
Dir.exists?("#{project_root}/.checkpoints/environments/#{environment_name}")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/bebox/logger.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
# A simple logger with colored output (logs to STDOUT)
|
4
|
+
module Bebox
|
5
|
+
module Logger
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.extend(self)
|
9
|
+
end
|
10
|
+
|
11
|
+
def msg(message)
|
12
|
+
puts message.white
|
13
|
+
end
|
14
|
+
|
15
|
+
def linebreak
|
16
|
+
puts "\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
def info(message)
|
20
|
+
puts "\n#{message.yellow}\n\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
def title(message)
|
24
|
+
puts "\n#{message.cyan}\n\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def warn(message)
|
28
|
+
puts "\n#{message.yellow}\n\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
def error(message)
|
32
|
+
puts "\n#{message.red}\n\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
def quest(message)
|
36
|
+
puts "\n#{message.magenta}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def ok(message)
|
40
|
+
puts "\n#{message.green}\n\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def highline_warn(message)
|
44
|
+
"<%= color('#{message}', :yellow) %>"
|
45
|
+
end
|
46
|
+
|
47
|
+
def highline_quest(message)
|
48
|
+
"<%= color('#{message}', :magenta) %>"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|