Skip to content

Instantly share code, notes, and snippets.

@hpcprofessional
Last active May 1, 2020 18:00
Show Gist options
  • Save hpcprofessional/03100e873b244da48f46fcd1d207bdb2 to your computer and use it in GitHub Desktop.
Save hpcprofessional/03100e873b244da48f46fcd1d207bdb2 to your computer and use it in GitHub Desktop.
# A quick manifest to install vim-puppet and puppet-lint
#
# I use it when I'm standing up a random VM that I need to write puppet code on.
#
# It's also being used to troubleshoot this issue : https://tickets.puppetlabs.com/browse/PUP-6713
#
# Perhaps someday this will grow up into a full-fledged module, but now it's just the right size since it can just
# be copied and puppet apply'd.
#
# Please note that if running on a Puppet 3 system, you'll need to (temporarily) enable the future parser by adding parser=future in
# the [main] config block. If this applies to you, please strongly consider upgrading to Puppet 4.
#
class puppet_developer_vim (
String $user = 'root',
String $home = '/root',
) {
$vim = $::osfamily ? {
redhat => 'vim-enhanced',
debian => 'vim',
}
$rubygems = $::osfamily ? {
redhat => 'rubygems',
debian => 'ruby',
}
$packages = [$vim,$rubygems,'curl','git']
$packages.each | $index,$package | {
if defined(Package[$package])==false {
package { $package:
ensure => present,
}
}
}
package { 'puppet-lint':
ensure => latest,
provider => 'gem',
require => Package[$rubygems],
}
file { ["$home/.vim/","$home/.vim/autoload","$home/.vim/bundle"]:
owner => $user,
ensure => directory,
require => Package[$vim]
}
exec { "curl -LSso $home/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim":
path => '/bin:/usr/bin/',
require => [File["$home/.vim/autoload"],Package['curl']],
user => $user,
creates => "$home/.vim/autoload/pathogen.vim",
}
exec { "git clone git://github.com/rodjek/vim-puppet.git $home/.vim/bundle/puppet":
path => '/bin:/usr/bin/',
require => [File["$home/.vim/bundle"],Package['git']],
user => $user,
creates => "$home/.vim/bundle/puppet",
}
exec { "git clone git://github.com/godlygeek/tabular.git $home/.vim/bundle/tabular":
path => '/bin:/usr/bin/',
require => [File["$home/.vim/bundle"],Package['git']],
user => $user,
creates => "$home/.vim/bundle/tabular",
}
exec { "git clone git://github.com/scrooloose/syntastic.git $home/.vim/bundle/syntastic":
path => '/bin:/usr/bin/',
require => [File["$home/.vim/bundle"],Package['git']],
user => $user,
creates => "$home/.vim/bundle/syntastic",
}
exec { "git clone git://github.com/vim-ruby/vim-ruby.git $home/.vim/bundle/vim-ruby":
path => '/bin:/usr/bin/',
require => [File["$home/.vim/bundle"],Package['git']],
user => $user,
creates => "$home/.vim/bundle/vim-ruby",
}
file { "$home/.vimrc" :
ensure => file,
owner => $user,
content => 'execute pathogen#infect()
syntax on
set nu
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
'
}
# Commented out so as to not require puppetlabs/stdlib on the agent
# file_line { 'alias vi to vim' :
# path => "$home/.bashrc",
# line => 'alias vi="vim"',
#@}
#notify { '.bashrc updated. Don\'t forget to reload your shell':
# require => File_line['alias vi to vim'],
#}
}
include puppet_developer_vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment