Skip to content

Instantly share code, notes, and snippets.

@erochest
Last active December 17, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erochest/5621860 to your computer and use it in GitHub Desktop.
Save erochest/5621860 to your computer and use it in GitHub Desktop.
Some puppet files for setting up my personal config under a Vagrant-managed VM.
# A palate cleanser for apt.
exec { 'apt-get update':
path => ['/usr/bin'],
}
## These two use this module: https://github.com/erochest/puppet-omeka
## Use this to automate getting that set up: https://github.com/erochest/omeka-vm
class { 'omeka':
hostname => 'neatline.dev',
rootdir => '/vagrant',
debug => true,
require => [Exec['apt-get update'], Package['git']],
}
omeka::gitplugin { 'Neatline':
url => 'git://github.com/scholarslab/Neatline.git',
require => Class['Omeka'],
}
## This is so I can access the host from the VM more easily.
host { 'host.dev':
ip => '137.54.155.210',
}
## This starts my configuration
## Packages for my dev environment
package { ['vim', 'tmux', 'mercurial', 'exuberant-ctags', 'python-pip',
'ack-grep', 'git', 'git-all', 'git-extras', 'git-flow',
'python-dev']:
ensure => installed
}
## My account and setup
# This sets up SSH configuration. The key below is attached to my github
# account, so the VMs can access it. I store the keys for each project in a
# `.ssh` directory in the project's Vagrant directory.
file { '.ssh' :
mode => 0700,
path => '/home/vagrant/.ssh',
owner => 'vagrant',
ensure => directory,
}
file { '.ssh/config' :
mode => 0700,
path => '/home/vagrant/.ssh/config',
owner => 'vagrant',
content => "Host github.com\n\tStrictHostKeyChecking no\n",
require => File['.ssh'],
}
file { 'id_rsa' :
mode => 0600,
path => '/home/vagrant/.ssh/id_rsa',
owner => 'vagrant',
source => '/vagrant/.ssh/id_rsa',
require => File['.ssh'],
}
file { 'id_rsa.pub' :
mode => 0600,
path => '/home/vagrant/.ssh/id_rsa.pub',
owner => 'vagrant',
source => '/vagrant/.ssh/id_rsa.pub',
require => File['.ssh'],
}
## My configuration itself is managed by https://github.com/Ceasar/dots. I keep
## my config in a single github repo that contains my dotfiles as well as
## submodules for various other parts of the config (bash_it directory, vim
## files).
exec { 'git clone dots' :
command => 'git clone git://github.com/Ceasar/dots.git',
cwd => '/home/vagrant',
user => 'vagrant',
creates => '/home/vagrant/dots',
path => ['/bin', '/usr/bin'],
}
file { 'dots/plugins' :
path => '/home/vagrant/dots/plugins',
owner => 'vagrant',
ensure => directory,
require => Exec['git clone dots'],
}
exec { 'git clone dotfiles' :
command => 'git clone git://github.com/erochest/dotfiles.git --recursive',
cwd => '/home/vagrant/dots/plugins',
user => 'vagrant',
creates => '/home/vagrant/dots/plugins/dotfiles',
path => ['/bin', '/usr/bin'],
require => [File['id_rsa'], File['.ssh/config']],
}
exec { 'pip install requirements' :
command => 'pip install --user -r requirements.txt',
cwd => '/home/vagrant/dots',
user => 'vagrant',
path => ['/bin', '/usr/bin', '/usr/local/bin'],
creates => '/home/vagrant/.local/bin/fab',
require => [Package['python-dev'], Package['python-pip'], Exec['git clone dots']],
}
file { '.bashrc' :
path => '/home/vagrant/.bashrc',
ensure => absent,
}
exec { 'fab link:plugins' :
cwd => '/home/vagrant/dots',
user => 'vagrant',
path => ['/bin', '/usr/bin', '/usr/local/bin', '/home/vagrant/.local/bin'],
environment => 'HOME=/home/vagrant',
require => [Exec['pip install requirements'], Exec['git clone dotfiles'], File['.bashrc']],
}
## The rest of this is untested.
## This installs my Vim plugins.
file { 'vimrc' :
ensure => link,
source => '/home/vagrant/.vim/vimrc',
target => '/home/vagrant/.vimrc',
owner => 'vagrant',
require => Exec['fab link:plugins'],
}
exec { 'git clone vundle' :
command => 'git clone https://github.com/gmarik/vundle.git ./bundle/vundle',
cwd => '/home/vagrant/.vim',
user => 'vagrant',
path => ['/bin', '/usr/bin', '/usr/local/bin', '/home/vagrant/.local/bin'],
environment => 'HOME=/home/vagrant',
require => Exec['fab link:plugins'],
}
exec { 'vim +BundleInstall +qall' :
cwd => '/home/vagrant',
user => 'vagrant',
path => ['/bin', '/usr/bin', '/usr/local/bin', '/home/vagrant/.local/bin'],
environment => 'HOME=/home/vagrant',
require => [File['vimrc'], Exec['git clone vundle']],
}
# TODO: why are some bash aliases not getting loaded?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment