Making things work...

This commit is contained in:
Gene Liverman 2017-06-03 11:10:10 -07:00
parent 91110e2534
commit 77fce59b08
11 changed files with 137 additions and 22 deletions

View file

@ -14,6 +14,7 @@ group :production do
gem 'puppet', puppetversion gem 'puppet', puppetversion
gem 'r10k', '~> 2.3' gem 'r10k', '~> 2.3'
gem 'rugged', '~> 0.24' gem 'rugged', '~> 0.24'
gem 'xmlrpc', '~> 0.3.0'
end end
group :development, :unit_tests do group :development, :unit_tests do

View file

@ -145,6 +145,7 @@ GEM
wisper (~> 1.6.1) wisper (~> 1.6.1)
unicode-display_width (1.2.1) unicode-display_width (1.2.1)
wisper (1.6.1) wisper (1.6.1)
xmlrpc (0.3.0)
yamllint (0.0.9) yamllint (0.0.9)
trollop (~> 2) trollop (~> 2)
@ -178,6 +179,7 @@ DEPENDENCIES
tty-command (~> 0.4) tty-command (~> 0.4)
tty-file (~> 0.3) tty-file (~> 0.3)
tty-prompt (~> 0.12) tty-prompt (~> 0.12)
xmlrpc (~> 0.3.0)
yamllint (~> 0.0.9) yamllint (~> 0.0.9)
BUNDLED WITH BUNDLED WITH

View file

@ -31,13 +31,21 @@ My dot files and a tool to deploy them to various OS's
```bash ```bash
git clone git@github.com:genebean/dots.git ~/.dotfiles git clone git@github.com:genebean/dots.git ~/.dotfiles
cd ~/.dotfiles cd ~/.dotfiles
bundle install bin/bootstrap.sh
bundle exec r10k puppetfile install --puppetfile ~/.dotfiles/production/puppet/Puppetfile -v This script takes care of getting dots ready to use
Enter the number of the task you want to perform:
1) Mac setup
2) EL setup
3) Quit
Task:
``` ```
#### Running Puppet #### Running Puppet
```bash ```bash
# Any of these will work:
bundle exec rake dots:run_puppet
bundle exec rake dots:run_puppet_noop
bundle exec puppet apply --environmentpath ~/.dotfiles/puppet ~/.dotfiles/puppet/production/manifests/site.pp bundle exec puppet apply --environmentpath ~/.dotfiles/puppet ~/.dotfiles/puppet/production/manifests/site.pp
``` ```
@ -68,9 +76,9 @@ cd ~/repos/powerline-fonts
##### Thoughts on installing with Puppet: ##### Thoughts on installing with Puppet:
* install packages using a provider for homebrew * [x] install packages using a provider for homebrew
* install packages using the pip provider * [ ] install packages using the pip provider
* use vcsrepo to clone the fonts * [ ] use vcsrepo to clone the fonts
* create a refresh-only exec that runs the install script * [ ] create a refresh-only exec that runs the install script
* add a notify to the vcsrepo resource that triggers the exec * [ ] add a notify to the vcsrepo resource that triggers the exec
* this will also take care of bringing in new fonts or updates * this will also take care of bringing in new fonts or updates

View file

@ -65,6 +65,11 @@ task :tests do
Rake::Task[:spec].invoke Rake::Task[:spec].invoke
end end
desc 'Run dots'
task :dots do
ruby 'bin/dots.rb'
end
namespace 'dots' do namespace 'dots' do
cmd = TTY::Command.new cmd = TTY::Command.new
@ -82,4 +87,12 @@ namespace 'dots' do
~/.dotfiles/puppet/production/manifests/site.pp' ~/.dotfiles/puppet/production/manifests/site.pp'
cmd.run(command) cmd.run(command)
end end
desc 'Run Puppet (noop)'
task :run_puppet_noop do
command = 'bundle exec puppet apply \
--environmentpath ~/.dotfiles/puppet \
~/.dotfiles/puppet/production/manifests/site.pp --noop'
cmd.run(command)
end
end end

24
bin/bootstrap.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
echo 'This script takes care of getting dots ready to use'
echo 'Enter the number of the task you want to perform:'
PS3='Task: '
select TASK in 'Mac setup' 'EL setup' 'Quit';
do
case $TASK in
'Mac setup' )
~/.dotfile/bin/bootstrap/bootstrap_mac.sh now
;;
'EL setup' )
~/.dotfile/bin/bootstrap/bootstrap_el.sh now
;;
'Quit' )
echo 'Exiting'
exit 0
;;
* )
echo 'Invalid selection, quitting.'
exit 1
;;
esac
done

21
bin/bootstrap/bootstrap_mac.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ $1 == 'now' ]]; then
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install dot's dependencies
/usr/local/bin/brew install ruby cmake pkg-config
/usr/local/bin/gem install --no-ri --no-rdoc bundler
# Make dot usable
cd ~/.dotfiles
/usr/local/bin/bundle install
# Install Puppet modules
/usr/local/bin/bundle exec rake dots:run_r10k
# Display tasks that can be run
echo 'These are the task that can now be executed:'
/usr/local/bin/bundle exec rake -T |grep --color=never 'rake dots'
fi

View file

@ -1,9 +1,12 @@
# rubocop:disable FileName # rubocop:disable FileName
forge 'http://forge.puppetlabs.com' forge 'http://forge.puppetlabs.com'
# rubocop:disable Metrics/LineLength
# The next line translates to '../../vendor/puppet_modules' aka ~/.dotfiles/vendor/puppet_modules # The next line translates to '../../vendor/puppet_modules' aka ~/.dotfiles/vendor/puppet_modules
moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules" moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules"
# rubocop:enable Metrics/LineLength
mod 'homebrew',
:git => 'https://github.com/boxen/puppet-homebrew.git'
mod 'puppetlabs-vcsrepo', '1.5.0' mod 'puppetlabs-vcsrepo', '1.5.0'
mod 'thekevjames-homebrew',
git: 'https://github.com/genebean/puppet-homebrew.git',
branch: 'non-root-and-bundler'

View file

@ -1,2 +1,2 @@
modulepath = modules:site:$basemodulepath modulepath = modules:site:~/.dotfiles/vendor/puppet_modules:$basemodulepath
config_version = 'scripts/config_version.sh $environmentpath $environment' config_version = 'scripts/config_version.sh $environmentpath'

View file

@ -10,3 +10,7 @@
node default { node default {
notify{'This is from the default node.':} notify{'This is from the default node.':}
} }
node 'dawns-macbook-pro.local' {
include ::profile::mac
}

View file

@ -1,12 +1,5 @@
#!/bin/bash #!/bin/bash
if [ -e $1/$2/.r10k-deploy.json ]
then /usr/bin/git --version > /dev/null 2>&1 &&
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/code_manager_config_version.rb $1 $2 /usr/bin/git --git-dir $1/../.git rev-parse HEAD ||
elif [ -e /opt/puppetlabs/server/pe_version ] date +%s
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2
else
/usr/bin/git --version > /dev/null 2>&1 &&
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD ||
date +%s
fi

View file

@ -0,0 +1,46 @@
# this contains the mac specific stuff
class profile::mac {
# $path = '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin'
# notify{'This is from the mac profile.':}
# exec { 'install homebrew':
# command => '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"',
# path => $path,
# creates => '/usr/local/bin/brew',
# }
#Package { provider => 'homebrew' }
$homebrew_packages = [
'bash-completion',
'bundler-completion',
'cmake',
'coreutils',
'docker-completion',
'elixir',
'erlang',
'figlet',
'git',
'git-flow',
'gnu-tar',
'hub',
'iftop',
'mutt',
'packer',
'python',
'ruby',
'sl',
'socat',
'tmux',
'tree',
'unrar',
'vagrant-completion',
'watch',
'wget',
'zsh',
'zsh-completions',
]
package { $homebrew_packages:
ensure => installed,
provider => 'brew',
}
}