From 14680c582c81c7b47970d07142bc6b5918df5aaf Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sun, 4 Jun 2017 23:56:56 -0700 Subject: [PATCH] Lots of updates :) --- DevelopmentPlan.md | 40 ++----------------- Rakefile | 6 +++ bin/dots.rb | 1 + puppet/production/hiera.yaml | 2 +- puppet/production/hieradata/common.yaml | 1 + ...-Pro.local.yaml => Dawns-MacBook-Pro.yaml} | 0 puppet/production/manifests/site.pp | 4 +- .../production/site/profile/manifests/base.pp | 8 ++++ .../production/site/profile/manifests/mac.pp | 25 +++++++++++- .../site/role/manifests/workstation.pp | 9 +++++ 10 files changed, 55 insertions(+), 41 deletions(-) rename puppet/production/hieradata/nodes/{Dawns-MacBook-Pro.local.yaml => Dawns-MacBook-Pro.yaml} (100%) diff --git a/DevelopmentPlan.md b/DevelopmentPlan.md index fc5845b..bd025c1 100644 --- a/DevelopmentPlan.md +++ b/DevelopmentPlan.md @@ -21,38 +21,6 @@ My dot files and a tool to deploy them to various OS's * use [gosu](https://github.com/tianon/gosu) so ownership is correct. * this may not work on Windows... -### Notes thus far - -1. Install Homebrew -2. Install ruby >= 2.0 (testing with 2.4.1) -3. Install bundler -4. Install cmake and pkg-config - -```bash -git clone git@github.com:genebean/dots.git ~/.dotfiles -cd ~/.dotfiles -bin/bootstrap.sh -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 - -```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 -``` - -#### Installed Homebrew packages - -To see what has been installed (not the deps) run `brew leaves` - ### Packages to install on Mac's @@ -77,8 +45,8 @@ cd ~/repos/powerline-fonts ##### Thoughts on installing with Puppet: * [x] install packages using a provider for homebrew -* [ ] install packages using the pip provider -* [ ] use vcsrepo to clone the fonts -* [ ] create a refresh-only exec that runs the install script -* [ ] add a notify to the vcsrepo resource that triggers the exec +* [x] install packages using the pip provider +* [x] use vcsrepo to clone the fonts +* [x] create a refresh-only exec that runs the install script +* [x] add a notify to the vcsrepo resource that triggers the exec * this will also take care of bringing in new fonts or updates diff --git a/Rakefile b/Rakefile index 5fd9206..7cc06c8 100644 --- a/Rakefile +++ b/Rakefile @@ -94,4 +94,10 @@ namespace 'dots' do ~/.dotfiles/puppet/production/manifests/site.pp --noop' cmd.run(command) end + + desc 'Install Vundle Plugins' + task :vim_plugins do + command = 'vim +PluginInstall +qall' + cmd.run(command) + end end diff --git a/bin/dots.rb b/bin/dots.rb index ee7e668..aab9439 100755 --- a/bin/dots.rb +++ b/bin/dots.rb @@ -72,5 +72,6 @@ when 'link' when 'install' if @prompt.yes?('Are you sure you want to install your base packages?') cmd.run('bundle exec rake dots:run_puppet') + cmd.run('bundle exec rake dots:vim_plugins') end end diff --git a/puppet/production/hiera.yaml b/puppet/production/hiera.yaml index d438127..10370e4 100644 --- a/puppet/production/hiera.yaml +++ b/puppet/production/hiera.yaml @@ -6,6 +6,6 @@ defaults: # Used for any hierarchy level that omits these keys. hierarchy: - name: "Per-node data" - path: "nodes/%{trusted.certname}.yaml" + path: "nodes/%{hostname}.yaml" - name: "Common data" path: "common.yaml" diff --git a/puppet/production/hieradata/common.yaml b/puppet/production/hieradata/common.yaml index ed97d53..23809fe 100644 --- a/puppet/production/hieradata/common.yaml +++ b/puppet/production/hieradata/common.yaml @@ -1 +1,2 @@ --- +foo: bar diff --git a/puppet/production/hieradata/nodes/Dawns-MacBook-Pro.local.yaml b/puppet/production/hieradata/nodes/Dawns-MacBook-Pro.yaml similarity index 100% rename from puppet/production/hieradata/nodes/Dawns-MacBook-Pro.local.yaml rename to puppet/production/hieradata/nodes/Dawns-MacBook-Pro.yaml diff --git a/puppet/production/manifests/site.pp b/puppet/production/manifests/site.pp index c6844c2..e83d9ed 100644 --- a/puppet/production/manifests/site.pp +++ b/puppet/production/manifests/site.pp @@ -11,6 +11,6 @@ node default { notify{'This is from the default node.':} } -node 'dawns-macbook-pro.local' { - include ::profile::mac +node 'dawns-macbook-pro' { + include ::role::workstation } diff --git a/puppet/production/site/profile/manifests/base.pp b/puppet/production/site/profile/manifests/base.pp index e1e831d..e4fef8f 100644 --- a/puppet/production/site/profile/manifests/base.pp +++ b/puppet/production/site/profile/manifests/base.pp @@ -1,4 +1,12 @@ # the base profile should include component modules that will be on all nodes class profile::base { + $pip_packages = [ + 'psutil', + 'powerline-status', + ] + package { $pip_packages: + ensure => 'latest', + provider => 'pip', + } } diff --git a/puppet/production/site/profile/manifests/mac.pp b/puppet/production/site/profile/manifests/mac.pp index 1068736..a5ca7df 100644 --- a/puppet/production/site/profile/manifests/mac.pp +++ b/puppet/production/site/profile/manifests/mac.pp @@ -42,12 +42,33 @@ class profile::mac { ] package { $homebrew_packages: - ensure => 'installed', + ensure => 'latest', provider => 'brew', } + file { "${homedir}/repos": + ensure => 'directory', + } + vcsrepo { "${homedir}/.vim/bundle/Vundle.vim": - ensure => 'present', + ensure => 'latest', provider => 'git', + source => 'https://github.com/VundleVim/Vundle.vim.git', + } + + vcsrepo { "${homedir}/repos/powerline-fonts": + ensure => 'latest', + provider => 'git', + source => 'https://github.com/powerline/fonts.git', + require => File["${homedir}/repos"], + notify => Exec['update-fonts'], + } + + exec { 'update-fonts': + command => "${homedir}/repos/powerline-fonts/install.sh", + cwd => "${homedir}/repos/powerline-fonts", + logoutput => true, + environment => "HOME=${homedir}", + refreshonly => true, } } diff --git a/puppet/production/site/role/manifests/workstation.pp b/puppet/production/site/role/manifests/workstation.pp index 27ee006..1f6ba72 100644 --- a/puppet/production/site/role/manifests/workstation.pp +++ b/puppet/production/site/role/manifests/workstation.pp @@ -1,4 +1,13 @@ # Includes all the profiles needed for a workstation class role::workstation { include ::profile::base + + case $facts['kernel'] { + 'Darwin': { + include ::profile::mac + } + default: { + fail("${facts['kernel']} hasn't been setup in the workstation role yet.") + } + } # end of kernel case statement }