From b0ec3a08ba4c86331d44081b432dcfc51d8a5cb1 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Mon, 18 Sep 2017 19:01:57 -0700 Subject: [PATCH 1/6] Added support for Linux Mint --- Gemfile | 20 +-- Gemfile.lock | 111 +++++++------- bin/bootstrap.sh | 5 +- bin/bootstrap/bootstrap_el.sh | 0 bin/bootstrap/bootstrap_mint.sh | 21 +++ bin/dots.rb | 4 +- link/linux/tmux.conf | 1 + link/linux/vimrc_os_specific | 1 + link/{nix => mac}/tmux.conf | 0 link/mac/vimrc_os_specific | 3 + link/nix/vimrc | 5 +- link/nix/zshrc | 16 ++- puppet/production/Puppetfile | 4 +- .../hieradata/nodes/mintstring.yaml | 2 + .../lib/puppet/functions/find_group.rb | 10 ++ .../lib/puppet/functions/find_owner.rb | 10 ++ puppet/production/manifests/site.pp | 12 +- .../custom_facts/lib/facter/os_release.rb | 19 +++ .../production/site/profile/manifests/base.pp | 10 +- .../site/profile/manifests/linux.pp | 20 +++ .../site/profile/manifests/linux/debian.pp | 135 ++++++++++++++++++ .../production/site/profile/manifests/mac.pp | 12 ++ .../site/role/manifests/workstation.pp | 3 + 23 files changed, 337 insertions(+), 87 deletions(-) mode change 100644 => 100755 bin/bootstrap/bootstrap_el.sh create mode 100755 bin/bootstrap/bootstrap_mint.sh create mode 100644 link/linux/tmux.conf create mode 100644 link/linux/vimrc_os_specific rename link/{nix => mac}/tmux.conf (100%) create mode 100644 link/mac/vimrc_os_specific create mode 100644 puppet/production/hieradata/nodes/mintstring.yaml create mode 100644 puppet/production/lib/puppet/functions/find_group.rb create mode 100644 puppet/production/lib/puppet/functions/find_owner.rb create mode 100644 puppet/production/site/custom_facts/lib/facter/os_release.rb create mode 100644 puppet/production/site/profile/manifests/linux.pp create mode 100644 puppet/production/site/profile/manifests/linux/debian.pp diff --git a/Gemfile b/Gemfile index 35c4e1b..e55fa26 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source 'https://rubygems.org' if ENV.key?('PUPPET_VERSION') puppetversion = ENV['PUPPET_VERSION'].to_s else - puppetversion = ['>= 4.9', '< 5'] + puppetversion = ['>= 5', '< 6'] end # rubocop:enable ConditionalAssignment @@ -13,23 +13,23 @@ group :production do gem 'os', '~> 1.0' gem 'puppet', puppetversion gem 'r10k', '~> 2.5' - gem 'rugged', '~> 0.24' + gem 'rugged', '~> 0.26' gem 'xmlrpc', '~> 0.3.0' if RUBY_VERSION >= '2.3' end group :development, :unit_tests do gem 'json', '>= 2.0.2' - gem 'metadata-json-lint', '~> 1.2' - gem 'puppetlabs_spec_helper', '~> 2.1' - gem 'rspec-puppet', '~> 2.5' - gem 'rubocop', '~> 0.49' - gem 'tty-command', '~> 0.4' - gem 'tty-file', '~> 0.3' - gem 'tty-prompt', '~> 0.12' + gem 'metadata-json-lint', '~> 2.0' + gem 'puppetlabs_spec_helper', '~> 2.3' + gem 'rspec-puppet', '~> 2.6' + gem 'rubocop', '~> 0.50' + gem 'tty-command', '~> 0.6' + gem 'tty-file', '~> 0.4' + gem 'tty-prompt', '~> 0.13' gem 'yamllint', '~> 0.0.9' # puppet-lint and plugins - gem 'puppet-lint', '~> 2.2' + gem 'puppet-lint', '~> 2.3' gem 'puppet-lint-absolute_classname-check', '~> 0.2' gem 'puppet-lint-absolute_template_path', '~> 1.0' gem 'puppet-lint-empty_string-check', '~> 0.2' diff --git a/Gemfile.lock b/Gemfile.lock index 3c7bff9..343450e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,66 +1,68 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.2.8) + CFPropertyList (2.3.5) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) ast (2.3.0) colored (1.2) cri (2.6.1) colored (~> 1.2) diff-lcs (1.3) equatable (0.5.0) - facter (2.4.6) - facter (2.4.6-universal-darwin) - CFPropertyList (~> 2.2.6) + facter (2.5.1) + facter (2.5.1-universal-darwin) + CFPropertyList (~> 2.2) faraday (0.9.2) multipart-post (>= 1.2, < 3) faraday_middleware (0.10.1) faraday (>= 0.7.4, < 1.0) fast_gettext (1.1.0) - gettext (3.2.2) + gettext (3.2.4) locale (>= 2.0.5) text (>= 1.3.0) - gettext-setup (0.25) + gettext-setup (0.28) fast_gettext (~> 1.1.0) gettext (>= 3.0.2) locale - hiera (3.3.1) + hiera (3.4.2) + hitimes (1.2.6) json (2.1.0) - json_pure (1.8.6) + json-schema (2.8.0) + addressable (>= 2.4) locale (2.1.2) log4r (1.1.10) metaclass (0.0.4) - metadata-json-lint (1.2.2) - json - semantic_puppet (>= 0.1.2, < 2.0.0) + metadata-json-lint (2.0.2) + json-schema (~> 2.8) spdx-licenses (~> 1.0) minitar (0.6.1) - mocha (1.2.1) + mocha (1.3.0) metaclass (~> 0.0.1) - multi_json (1.12.1) + multi_json (1.12.2) multipart-post (2.0.0) necromancer (0.4.0) os (1.0.0) - parallel (1.11.2) + parallel (1.12.0) parser (2.4.0.0) ast (~> 2.2) pastel (0.7.1) equatable (~> 0.5.0) tty-color (~> 0.4.0) powerpack (0.1.1) - puppet (4.10.1) + public_suffix (3.0.0) + puppet (5.3.2) facter (> 2.0, < 4) gettext-setup (>= 0.10, < 1) - hiera (>= 2.0, < 4) - json_pure (~> 1.8) + hiera (>= 3.2.1, < 4) locale (~> 2.1) - puppet (4.10.1-universal-darwin) - CFPropertyList (~> 2.2.6) + puppet (5.3.2-universal-darwin) + CFPropertyList (~> 2.2) facter (> 2.0, < 4) gettext-setup (>= 0.10, < 1) - hiera (>= 2.0, < 4) - json_pure (~> 1.8) + hiera (>= 3.2.1, < 4) locale (~> 2.1) - puppet-lint (2.2.1) + puppet-lint (2.3.3) puppet-lint-absolute_classname-check (0.2.4) puppet-lint (>= 1.0, < 3.0) puppet-lint-absolute_template_path (1.0.1) @@ -81,15 +83,15 @@ GEM puppet-lint (>= 1.0, < 3.0) puppet-lint-variable_contains_upcase (1.2.0) puppet-lint (>= 1.0, < 3.0) - puppet-syntax (2.4.0) + puppet-syntax (2.4.1) rake - puppet_forge (2.2.4) + puppet_forge (2.2.6) faraday (~> 0.9.0) faraday_middleware (>= 0.9.0, < 0.11.0) gettext-setup (~> 0.11) minitar semantic_puppet (~> 0.1.0) - puppetlabs_spec_helper (2.1.3) + puppetlabs_spec_helper (2.3.2) mocha (~> 1.0) puppet-lint (~> 2.0) puppet-syntax (~> 2.0) @@ -104,7 +106,7 @@ GEM semantic_puppet (~> 0.1.0) rainbow (2.2.2) rake - rake (12.0.0) + rake (12.1.0) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -117,38 +119,43 @@ GEM rspec-mocks (3.6.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.6.0) - rspec-puppet (2.5.0) + rspec-puppet (2.6.9) rspec rspec-support (3.6.0) - rubocop (0.49.1) + rubocop (0.50.0) parallel (~> 1.10) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) + rainbow (>= 2.2.2, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) - rugged (0.25.1.1) + ruby-progressbar (1.9.0) + rugged (0.26.0) semantic_puppet (0.1.4) gettext-setup (>= 0.3) spdx-licenses (1.1.0) text (1.3.1) + timers (4.1.2) + hitimes trollop (2.1.2) tty-color (0.4.2) - tty-command (0.4.0) + tty-command (0.6.0) pastel (~> 0.7.0) - tty-cursor (0.4.0) - tty-file (0.3.0) + tty-cursor (0.5.0) + tty-file (0.4.0) diff-lcs (~> 1.3.0) - pastel (~> 0.7.0) - tty-prompt (~> 0.12.0) - tty-prompt (0.12.0) + pastel (~> 0.7.1) + tty-prompt (~> 0.13.2) + tty-prompt (0.13.2) necromancer (~> 0.4.0) pastel (~> 0.7.0) - tty-cursor (~> 0.4.0) - wisper (~> 1.6.1) - unicode-display_width (1.2.1) - wisper (1.6.1) + timers (~> 4.1.2) + tty-cursor (~> 0.5.0) + tty-reader (~> 0.1.0) + tty-reader (0.1.0) + wisper (~> 2.0.0) + unicode-display_width (1.3.0) + wisper (2.0.0) xmlrpc (0.3.0) yamllint (0.0.9) trollop (~> 2) @@ -160,10 +167,10 @@ PLATFORMS DEPENDENCIES json (>= 2.0.2) - metadata-json-lint (~> 1.2) + metadata-json-lint (~> 2.0) os (~> 1.0) - puppet (>= 4.9, < 5) - puppet-lint (~> 2.2) + puppet (>= 5, < 6) + puppet-lint (~> 2.3) puppet-lint-absolute_classname-check (~> 0.2) puppet-lint-absolute_template_path (~> 1.0) puppet-lint-empty_string-check (~> 0.2) @@ -174,16 +181,16 @@ DEPENDENCIES puppet-lint-undef_in_function-check (~> 0.2) puppet-lint-unquoted_string-check (~> 0.3) puppet-lint-variable_contains_upcase (~> 1.2) - puppetlabs_spec_helper (~> 2.1) + puppetlabs_spec_helper (~> 2.3) r10k (~> 2.5) - rspec-puppet (~> 2.5) - rubocop (~> 0.49) - rugged (~> 0.24) - tty-command (~> 0.4) - tty-file (~> 0.3) - tty-prompt (~> 0.12) + rspec-puppet (~> 2.6) + rubocop (~> 0.50) + rugged (~> 0.26) + tty-command (~> 0.6) + tty-file (~> 0.4) + tty-prompt (~> 0.13) xmlrpc (~> 0.3.0) yamllint (~> 0.0.9) BUNDLED WITH - 1.14.6 + 1.15.4 diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index b579b2f..33a70c2 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -3,7 +3,7 @@ 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'; +select TASK in 'Mac setup' 'EL setup' 'Mint setup' 'Quit'; do case $TASK in 'Mac setup' ) @@ -12,6 +12,9 @@ do 'EL setup' ) ~/.dotfiles/bin/bootstrap/bootstrap_el.sh now ;; + 'Mint setup' ) + ~/.dotfiles/bin/bootstrap/bootstrap_mint.sh now + ;; 'Quit' ) echo 'Exiting' exit 0 diff --git a/bin/bootstrap/bootstrap_el.sh b/bin/bootstrap/bootstrap_el.sh old mode 100644 new mode 100755 diff --git a/bin/bootstrap/bootstrap_mint.sh b/bin/bootstrap/bootstrap_mint.sh new file mode 100755 index 0000000..a185b88 --- /dev/null +++ b/bin/bootstrap/bootstrap_mint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ $1 == 'now' ]]; then + # Install dot's dependencies + sudo apt-add-repository ppa:brightbox/ruby-ng + sudo apt-get update + sudo apt-get install ruby2.4 ruby2.4-dev ruby-switch cmake build-essential + sudo ruby-switch --set ruby2.4 + sudo gem install --no-ri --no-rdoc bundler + + # Make dot usable + cd ~/.dotfiles + bundle install + + # Install Puppet modules + bundle exec rake dots:run_r10k + + # Display tasks that can be run + echo 'These are the task that can now be executed:' + bundle exec rake -T |grep --color=never 'rake dots' +fi diff --git a/bin/dots.rb b/bin/dots.rb index aa3aef9..f861bf8 100755 --- a/bin/dots.rb +++ b/bin/dots.rb @@ -10,7 +10,7 @@ cmd = TTY::Command.new @home = File.expand_path('~') @dotroot = File.dirname(File.dirname(File.expand_path($PROGRAM_NAME))) -@excludes = %w[mac nix ssh] +@excludes = %w[linux mac nix ssh] @files_copy = Dir.glob("#{@dotroot}/copy/*") @files_link = Dir.glob("#{@dotroot}/link/*") @ssh_link = Dir.glob("#{@dotroot}/link/ssh/*") @@ -30,7 +30,7 @@ elsif OS.mac? @files_link.concat Dir.glob("#{@dotroot}/link/mac/*") elsif OS.linux? - puts 'It seems you are on Linux' + @files_link.concat Dir.glob("#{@dotroot}/link/linux/*") else abort("I'm not sure what to do with this OS...") unless OS.posix? diff --git a/link/linux/tmux.conf b/link/linux/tmux.conf new file mode 100644 index 0000000..e3987af --- /dev/null +++ b/link/linux/tmux.conf @@ -0,0 +1 @@ +source "/usr/share/powerline/bindings/tmux/powerline.conf" diff --git a/link/linux/vimrc_os_specific b/link/linux/vimrc_os_specific new file mode 100644 index 0000000..75f4f07 --- /dev/null +++ b/link/linux/vimrc_os_specific @@ -0,0 +1 @@ +set rtp+='/usr/share/vim/addons/plugin/powerline.vim' diff --git a/link/nix/tmux.conf b/link/mac/tmux.conf similarity index 100% rename from link/nix/tmux.conf rename to link/mac/tmux.conf diff --git a/link/mac/vimrc_os_specific b/link/mac/vimrc_os_specific new file mode 100644 index 0000000..fa051b5 --- /dev/null +++ b/link/mac/vimrc_os_specific @@ -0,0 +1,3 @@ +python from powerline.vim import setup as powerline_setup +python powerline_setup() +python del powerline_setup diff --git a/link/nix/vimrc b/link/nix/vimrc index 5cd0ee4..48009b4 100644 --- a/link/nix/vimrc +++ b/link/nix/vimrc @@ -57,7 +57,4 @@ let g:syntastic_ruby_checkers = ['rubocop'] let g:syntastic_quiet_messages = {'level': 'warnings'} let g:vim_markdown_folding_disabled = 1 -python from powerline.vim import setup as powerline_setup -python powerline_setup() -python del powerline_setup - +source ~/.vimrc_os_specific diff --git a/link/nix/zshrc b/link/nix/zshrc index 8831250..b855c76 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -4,10 +4,13 @@ export ZSH=~/.oh-my-zsh # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -#ZSH_THEME="af-magic" -#ZSH_THEME="pygmalion" -#ZSH_THEME="muse" -ZSH_THEME="beanbag" +if [[ `uname` == 'Linux' ]]; then + ZSH_THEME="af-magic" +else + ZSH_THEME="beanbag" + #ZSH_THEME="pygmalion" + #ZSH_THEME="muse" +fi # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" @@ -61,6 +64,11 @@ source $ZSH/oh-my-zsh.sh # export MANPATH="/usr/local/man:$MANPATH" +# Start GPG agent +export GPG_TTY=$(tty) +gpg-connect-agent /bye +export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh + # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. diff --git a/puppet/production/Puppetfile b/puppet/production/Puppetfile index c493322..b86446b 100644 --- a/puppet/production/Puppetfile +++ b/puppet/production/Puppetfile @@ -1,4 +1,4 @@ -# rubocop:disable Lint/UnneededDisable, Style/FileName +# rubocop:disable Lint/UnneededDisable, Naming forge 'http://forge.puppetlabs.com' # rubocop:disable Metrics/LineLength @@ -6,6 +6,8 @@ forge 'http://forge.puppetlabs.com' moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules" # rubocop:enable Metrics/LineLength +mod 'puppetlabs-apt', '4.1.0' +mod 'puppetlabs-stdlib', '4.20.0' mod 'puppetlabs-vcsrepo', '2.0.0' mod 'thekevjames-homebrew', git: 'https://github.com/genebean/puppet-homebrew.git', diff --git a/puppet/production/hieradata/nodes/mintstring.yaml b/puppet/production/hieradata/nodes/mintstring.yaml new file mode 100644 index 0000000..7b042ad --- /dev/null +++ b/puppet/production/hieradata/nodes/mintstring.yaml @@ -0,0 +1,2 @@ +--- +homedir: '/home/gene' diff --git a/puppet/production/lib/puppet/functions/find_group.rb b/puppet/production/lib/puppet/functions/find_group.rb new file mode 100644 index 0000000..68e589a --- /dev/null +++ b/puppet/production/lib/puppet/functions/find_group.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:find_group) do + dispatch :find_group do + param 'String', :some_path + return_type 'String' + end + + def find_group(some_path) + File.stat(some_path).gid.to_s + end +end diff --git a/puppet/production/lib/puppet/functions/find_owner.rb b/puppet/production/lib/puppet/functions/find_owner.rb new file mode 100644 index 0000000..105ce2e --- /dev/null +++ b/puppet/production/lib/puppet/functions/find_owner.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:find_owner) do + dispatch :find_owner do + param 'String', :some_path + return_type 'String' + end + + def find_owner(some_path) + File.stat(some_path).uid.to_s + end +end diff --git a/puppet/production/manifests/site.pp b/puppet/production/manifests/site.pp index 68fa735..e6a9fe6 100644 --- a/puppet/production/manifests/site.pp +++ b/puppet/production/manifests/site.pp @@ -11,11 +11,15 @@ node default { notify{'This is from the default node.':} } -node 'yellowbadger' { - include ::role::workstation -} - node 'gene' { include ::role::workstation } +node 'mintstring' { + include ::role::workstation +} + +node 'yellowbadger' { + include ::role::workstation +} + diff --git a/puppet/production/site/custom_facts/lib/facter/os_release.rb b/puppet/production/site/custom_facts/lib/facter/os_release.rb new file mode 100644 index 0000000..c3f50f2 --- /dev/null +++ b/puppet/production/site/custom_facts/lib/facter/os_release.rb @@ -0,0 +1,19 @@ +Facter.add(:os_release) do + confine kernel: 'Linux' + + setcode do + file_path = '/etc/os-release' + if File.exist?(file_path) + os_release_hash = {} + File.open(file_path, 'r') do |file| + file.each_line do |line| + line_data = line.split('=') + key = line_data[0].downcase + value = line_data[1].strip.gsub(/(^\")|(\"$)/, '') + os_release_hash[key] = value + end + end + os_release_hash + end + end +end diff --git a/puppet/production/site/profile/manifests/base.pp b/puppet/production/site/profile/manifests/base.pp index bf562d6..21d43e4 100644 --- a/puppet/production/site/profile/manifests/base.pp +++ b/puppet/production/site/profile/manifests/base.pp @@ -1,13 +1,5 @@ # 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', - require => Package['python'], - } } + diff --git a/puppet/production/site/profile/manifests/linux.pp b/puppet/production/site/profile/manifests/linux.pp new file mode 100644 index 0000000..b26b1bd --- /dev/null +++ b/puppet/production/site/profile/manifests/linux.pp @@ -0,0 +1,20 @@ +# Select a profile based on the OS family +class profile::linux { + case $facts['os']['family'] { + 'Debian': { include ::profile::linux::debian } + default: { fail("${facts['os']['family']} isn't supported yet") } + } + + exec { 'download hub': + path => '/bin:/usr/bin', + command => "curl -s https://api.github.com/repos/github/hub/releases/latest | grep \"browser_download_url.*linux-amd64\" | cut -d '\"' -f4 | xargs -n 1 curl -L | tar -xzvf - -C /tmp && mv /tmp/hub* /usr/local/hub", + creates => '/usr/local/hub', + } + + file {'/usr/local/bin/hub': + ensure => 'link', + target => '/usr/local/hub/bin/hub', + } + +} + diff --git a/puppet/production/site/profile/manifests/linux/debian.pp b/puppet/production/site/profile/manifests/linux/debian.pp new file mode 100644 index 0000000..5b2eff9 --- /dev/null +++ b/puppet/production/site/profile/manifests/linux/debian.pp @@ -0,0 +1,135 @@ +# Profile for the Debian family of OS's +class profile::linux::debian { + $homedir = lookup('homedir') + $uid = find_owner($homedir) + $gid = find_group($homedir) + + File { + owner => $uid, + group => $gid, + } + + Vcsrepo { + user => $uid, + owner => $uid, + group => $gid, + } + + if $facts['os_release']['ubuntu_codename'] { + $release = $facts['os_release']['ubuntu_codename'] + } + elsif $facts['os']['lsb']['distcodename'] { + $release = $facts['os']['lsb']['distcodename'] + } + else { + fail("Can't determine what to use in 'release' for the Docker repo") + } + + apt::source { 'docker': + location => 'https://download.docker.com/linux/ubuntu', + release => $release, + repos => 'stable', + key => { + 'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', + 'source' => 'https://download.docker.com/linux/ubuntu/gpg', + }, + } + + $apt_packages = [ + 'apt-transport-https', + 'bash-completion', + 'ca-certificates', + 'cmake', + 'coreutils', + 'curl', + 'figlet', + 'git', + 'git-flow', + 'pinentry-gnome3', + 'powerline', + 'python', + 'python-pip', + 'python-psutil', + 'scdaemon', + 'software-properties-common', + 'tmux', + 'tree', + 'yubikey-personalization-gui', + 'zsh', + ] + + package { $apt_packages: + ensure => 'installed', + require => Apt::Source['docker'], + } + + exec { 'set-shell-to-zsh': + path => '/bin:/usr/bin', + command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`", + cwd => $homedir, + logoutput => true, + environment => "HOME=${homedir}", + unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'", + } + + + $dirs = [ + "${homedir}/.local", + "${homedir}/.local/share", + "${homedir}/.local/share/fonts", + "${homedir}/.vim", + "${homedir}/.vim/bundle", + "${homedir}/repos", + ] + + file { $dirs: + ensure => 'directory', + } + + vcsrepo { "${homedir}/.oh-my-zsh": + ensure => 'present', + provider => 'git', + source => 'https://github.com/robbyrussell/oh-my-zsh.git', + } + + vcsrepo { "${homedir}/.oh-my-zsh/custom/themes": + ensure => 'latest', + provider => 'git', + source => 'git@github.com:genebean/my-oh-zsh-themes.git', + } + + vcsrepo { "${homedir}/.vim/bundle/Vundle.vim": + ensure => 'latest', + provider => 'git', + source => 'https://github.com/VundleVim/Vundle.vim.git', + require => File[$dirs], + } + + vcsrepo { "${homedir}/repos/powerline-fonts": + ensure => 'latest', + provider => 'git', + source => 'https://github.com/powerline/fonts.git', + require => File[$dirs], + 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, + notify => Exec['set-font-ownership'], + } + + exec { 'set-font-ownership': + path => '/bin:/usr/bin', + command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*", + cwd => $homedir, + logoutput => true, + environment => "HOME=${homedir}", + require => Exec['update-fonts'], + refreshonly => true, + } +} + diff --git a/puppet/production/site/profile/manifests/mac.pp b/puppet/production/site/profile/manifests/mac.pp index dffcdf2..539cb11 100644 --- a/puppet/production/site/profile/manifests/mac.pp +++ b/puppet/production/site/profile/manifests/mac.pp @@ -71,6 +71,18 @@ class profile::mac { provider => 'brewcask', } + $pip_packages = [ + 'psutil', + 'powerline-status', + ] + + package { $pip_packages: + ensure => 'latest', + provider => 'pip', + require => Package['python'], + } + + file { "${homedir}/repos": ensure => 'directory', } diff --git a/puppet/production/site/role/manifests/workstation.pp b/puppet/production/site/role/manifests/workstation.pp index 1f6ba72..e0ae415 100644 --- a/puppet/production/site/role/manifests/workstation.pp +++ b/puppet/production/site/role/manifests/workstation.pp @@ -6,6 +6,9 @@ class role::workstation { 'Darwin': { include ::profile::mac } + 'Linux': { + include ::profile::linux + } default: { fail("${facts['kernel']} hasn't been setup in the workstation role yet.") } From 3ffaad9cd29c8a32ee067faf1c90c98824915a3f Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 7 Oct 2017 21:15:32 -0700 Subject: [PATCH 2/6] Adjusted plugins and gpg stuff --- link/nix/zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/link/nix/zshrc b/link/nix/zshrc index b855c76..0206273 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -54,7 +54,7 @@ COMPLETION_WAITING_DOTS="false" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(brew bundler gem git git-flow gpg-agent history osx python vagrant) +plugins=(brew bundler gem git git-flow history osx pip python terraform vagrant) source $ZSH/oh-my-zsh.sh @@ -62,6 +62,11 @@ source $ZSH/oh-my-zsh.sh [ -f ~/.private-env ] && source ~/.private-env || echo '~/.private-env is missing' +# Start GPG agent +export GPG_TTY=$(tty) +gpg-connect-agent /bye +export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh + # export MANPATH="/usr/local/man:$MANPATH" # Start GPG agent From c011e29b4c6716cd3d514734923952b7e5379762 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 7 Oct 2017 21:15:59 -0700 Subject: [PATCH 3/6] added mouse support --- link/mac/tmux.conf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/link/mac/tmux.conf b/link/mac/tmux.conf index a6488ac..28031b4 100644 --- a/link/mac/tmux.conf +++ b/link/mac/tmux.conf @@ -1 +1,8 @@ source "/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf" + +# Make mouse useful in copy mode +set -g mouse on + +# Scroll History +set -g history-limit 30000 + From fe97959154be3e27007910333768bcce69296e5f Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 7 Oct 2017 21:16:16 -0700 Subject: [PATCH 4/6] Updated vim to fix powerline --- puppet/production/site/profile/manifests/mac.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/puppet/production/site/profile/manifests/mac.pp b/puppet/production/site/profile/manifests/mac.pp index 539cb11..3af1297 100644 --- a/puppet/production/site/profile/manifests/mac.pp +++ b/puppet/production/site/profile/manifests/mac.pp @@ -36,6 +36,7 @@ class profile::mac { 'tree', 'unrar', 'vagrant-completion', + 'vim', 'watch', 'wget', 'zsh', From e5500219a7efa874f387dfc9caf5407184d343d5 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sun, 15 Oct 2017 09:58:11 -0700 Subject: [PATCH 5/6] added /usr/local/sbin to PATH --- link/nix/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/link/nix/zshrc b/link/nix/zshrc index 0206273..a18d638 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -94,6 +94,7 @@ export POWERLINE_CONFIG_COMMAND='/usr/local/bin/powerline-config' export PATH=$PATH:~/.nexustools if [[ `uname` == 'Darwin' ]]; then + export PATH=$PATH:/usr/local/sbin export PATH=$PATH:/Applications/Araxis\ Merge.app/Contents/Utilities export PATH="/usr/local/opt/python/libexec/bin:$PATH" export PATH=$PATH:/usr/local/opt/node@6/bin From 3752c52e5ca998975cea49d9af5231932e98fbf9 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sun, 15 Oct 2017 10:30:00 -0700 Subject: [PATCH 6/6] Remove duplicate entry --- link/nix/zshrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/link/nix/zshrc b/link/nix/zshrc index a18d638..bde0f35 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -69,11 +69,6 @@ export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh # export MANPATH="/usr/local/man:$MANPATH" -# Start GPG agent -export GPG_TTY=$(tty) -gpg-connect-agent /bye -export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh - # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder.