Permalink
Browse files

it's a mess

  • Loading branch information...
mislav committed Aug 9, 2012
0 parents commit f7f466e672555856eeccd19fc1a1b7e037e85c19
Showing with 184 additions and 0 deletions.
  1. +6 −0 .gitmodules
  2. +49 −0 Vagrantfile
  3. +8 −0 apply.sh
  4. +51 −0 manifests/centos62-64.pp
  5. +1 −0 modules/postfix
  6. +1 −0 modules/rbenv
  7. +68 −0 readme.md
@@ -0,0 +1,6 @@
+[submodule "modules/rbenv"]
+ path = modules/rbenv
+ url = https://github.com/alup/puppet-rbenv
+[submodule "modules/postfix"]
+ path = modules/postfix
+ url = https://github.com/camptocamp/puppet-postfix
@@ -0,0 +1,49 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant::Config.run do |config|
+ # All Vagrant configuration is done here. The most common configuration
+ # options are documented and commented below. For a complete reference,
+ # please see the online documentation at vagrantup.com.
+
+ # Every Vagrant virtual environment requires a box to build off of.
+ config.vm.box = "centos62-64"
+
+ # The url from where the 'config.vm.box' box will be fetched if it
+ # doesn't already exist on the user's system.
+ config.vm.box_url = "http://packages.vstone.eu/vagrant-boxes/centos-6.2-64bit-latest.box"
+
+ # Boot with a GUI so you can see the screen. (Default is headless)
+ # config.vm.boot_mode = :gui
+
+ # Assign this VM to a host-only network IP, allowing you to access it
+ # via the IP. Host-only networks can talk to the host machine as well as
+ # any other machines on the same network, but cannot be accessed (through this
+ # network interface) by any external networks.
+ # config.vm.network :hostonly, "192.168.33.10"
+
+ # Assign this VM to a bridged network, allowing you to connect directly to a
+ # network using the host's network device. This makes the VM appear as another
+ # physical device on your network.
+ # config.vm.network :bridged
+
+ # Forward a port from the guest to the host, which allows for outside
+ # computers to access the VM, whereas host only networking does not.
+ # config.vm.forward_port 80, 8080
+
+ # Share an additional folder to the guest VM. The first argument is
+ # an identifier, the second is the path on the guest to mount the
+ # folder, and the third is the path on the host to the actual folder.
+ # config.vm.share_folder "v-data", "/vagrant_data", "../data"
+
+ # Enable provisioning with Puppet stand alone. Puppet manifests
+ # are contained in a directory path relative to this Vagrantfile.
+ # You will need to create the manifests directory and a manifest in
+ # the file centos62-64.pp in the manifests_path directory.
+
+ config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "manifests"
+ puppet.manifest_file = "centos62-64.pp"
+ puppet.module_path = "modules"
+ end
+end
@@ -0,0 +1,8 @@
+# quick 'n' dirty script to push recipes and execute puppet to my server
+
+self="$(basename "$0")"
+rsync -vtr --exclude .git/ --exclude "/${self}" manifests modules root@mislav:puppet
+ssh root@mislav '\
+ cd puppet && \
+ puppet apply --modulepath=modules --no-report \
+ manifests/centos62-64.pp'
@@ -0,0 +1,51 @@
+rbenv::install { 'deploy':
+ group => 'deploy',
+ home => '/home/deploy'
+}
+rbenv::compile { '1.9.3-p194':
+ user => 'deploy',
+ home => '/home/deploy'
+}
+rbenv::gem { 'bundler':
+ user => 'deploy',
+ ruby => '1.9.3-p194'
+}
+
+exec { 'rbenv::zsh':
+ command => "echo \"export PATH=$(pwd)/.rbenv/bin:\\\$PATH\neval \\\"\\\$(rbenv init -)\\\"\" >> .zshrc",
+ user => 'deploy',
+ cwd => '/home/deploy',
+ path => ['/bin', '/usr/bin', '/usr/sbin'],
+ unless => "grep 'rbenv init -' /home/deploy/.zshrc 2>/dev/null",
+ require => [ Class['rbenv'], Package['zsh'] ]
+}
+
+package { 'zsh':
+ ensure => present,
+ provider => yum
+}
+
+package { 'vim-enhanced':
+ ensure => present,
+ provider => yum
+}
+
+user { 'deploy':
+ ensure => present,
+ # gid => 'admin',
+ shell => '/bin/zsh',
+ home => '/home/deploy',
+ managehome => true
+}
+
+include postfix
+postfix::config { 'relay_domains':
+ value => "localhost mislav.net"
+}
+
+# ssh_authorized_key { 'id_rsa':
+# ensure => present,
+# user => 'deploy',
+# type => 'rsa',
+# key => ???
+# }
Submodule postfix added at 2ed158
Submodule rbenv added at 9be9f8
@@ -0,0 +1,68 @@
+# Mislav's Puppet experiments
+
+I'm no sysadmin expert but I've set up a personal server—usually
+Debian-flavored—countless times manually. Time to automatize this. I would want
+to be able to provision a single box quickly for personal use, but I want to do
+it via recipes that I can reply against another box whenever I want.
+
+I've brushed with Chef, but getting disillusioned with its steep learning curve,
+I've set out to try Puppet. Turns out, it's not any easier.
+
+![I have no idea what I'm doing](http://i0.kym-cdn.com/photos/images/newsfeed/000/234/142/196.jpg)
+
+Both Chef and Puppet seem designed for uses much more sophisticated than
+provisioning a single machine for personal use. I'm not sure if they're the
+right tool for the job for this.
+
+## What services I need
+
+* git
+* rbenv
+* postgresql, redis, mongo
+* memcached
+* nginx vhosts + Passenger, running multiple Ruby apps
+* postfix + dovecot, for personal email
+
+My target is CentOS 6.2 for now, but would like to support Ubuntu too so these
+recipes get some wider reusability.
+
+## How I'm using puppet
+
+I have installed "puppet" gem on the remote server. I rsync the "manifests" and
+"modules" directories from my local machine up to the server and run "puppet
+apply" there (see `apply.sh`).
+
+I'm using 2 puppet modules found on GitHub as git submodules: "rbenv" and "postfix".
+
+I test these recipes locally using Vagrant.
+
+## The problems that I have
+
+1. Using rbenv module doesn't work:
+
+ Could not autoload rbenvgem:
+ no such file to load -- puppet/provider/rbenvgem
+ at /root/puppet/modules/rbenv/manifests/gem.pp:22
+
+ I've read [Plugins in
+ modules](http://docs.puppetlabs.com/guides/plugins_in_modules.html) doc page,
+ but it doesn't shed any light to this issue. The files in
+ `{modulepath}/{module}/lib/pupppet/provider/` should be autoloaded, IMO.
+
+2. Using postfix module doesn't work:
+
+ notice: /Stage[main]/Postfix/Service[postfix]:
+ Dependency Augeas[set postfix 'myorigin' to 'li503-173.members.linode.com']
+ has failures: true
+
+ It seems that it needs Augeas. This keeps getting mentioned in Puppet world,
+ but even after briefly reading about this I'm no smarter as to what it is.
+
+## The questions that I have
+
+* How should I organize my manifests into multiple files once my setup grows?
+* Is there a better way to run recipes on my remote box (currently rsync)
+ without resorting to master-client model?
+* How can I automate provisioning a new box that can't run puppet yet (no Ruby,
+ rubygems, puppet gem installed); using old school shell scripts that I run via
+ ssh?

0 comments on commit f7f466e

Please sign in to comment.