Write Puppet manifests and modules faster with VIM 
Pierre Mavro 
www.enovance.com 
September 4, 2013
Write Puppet manifests and modules faster with VIM: Summary 
Summary 
1 Introduction . . . . . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Introduction 
Plan 
1 Introduction . . . . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Introduction 
Puppet Labs 
Puppet is IT automation software that gives...
Write Puppet manifests and modules faster with VIM: Introduction 
eNovance 
eNovance, an innovative French company that de...
Write Puppet manifests and modules faster with VIM: Introduction 
Plan 
1 Introduction . . . . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Introduction 
History 
Puppet announced in 2011 an IDE plugin for Ecli...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Plan 
2 Setup and usage . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Setup and usage 
Vundle 
What is Vundle ? Vundle is short for Vim bund...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Vundle 
When you will add new lines to declare new bu...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Plan 
2 Setup and usage . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Setup and usage 
Ultisnips 
Ultisnips helps on writing Puppet type ref...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Ultisnips 
Here is the result : 
test.pp 
class name ...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Plan 
2 Setup and usage . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Setup and usage 
VIM Puppet 
VIM Puppet provides : 
I Formatting based...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Plan 
2 Setup and usage . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Setup and usage 
Tabular 
This plugins helps on having signs alignment...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Tabular 
Anyway, for any reasons you want to do it ma...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Plan 
2 Setup and usage . . . . . . . . . . . . . . ....
Write Puppet manifests and modules faster with VIM: Setup and usage 
Syntastic 
Syntastic is a syntax checking plugin that...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Syntastic 
Pierre Mavro www.enovance.com 
Write Puppe...
Write Puppet manifests and modules faster with VIM: Setup and usage 
Syntastic 
When you move your cursor on a line beginn...
Write Puppet manifests and modules faster with VIM
Upcoming SlideShare
Loading in …5
×

Write Puppet manifests and modules faster with VIM

2,212 views

Published on

Those slides presents VIM modules to help on writing Puppet manifests and modules.

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,212
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
16
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Write Puppet manifests and modules faster with VIM

  1. 1. Write Puppet manifests and modules faster with VIM Pierre Mavro www.enovance.com September 4, 2013
  2. 2. Write Puppet manifests and modules faster with VIM: Summary Summary 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 2 / 23
  3. 3. Write Puppet manifests and modules faster with VIM: Introduction Plan 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 I Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 I History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 3 / 23
  4. 4. Write Puppet manifests and modules faster with VIM: Introduction Puppet Labs Puppet is IT automation software that gives system administrators the power to easily automate repetitive tasks, quickly deploy critical applications, and proactively manage infrastructure, on-premises or in the cloud. Puppet is a scalable and open source solution. A lot of modules exists on the official repository called Puppet forge : https://forge.puppetlabs.com/ If you search a specific module not available on Puppet forge and you will need to create your own. This task would take some time at first. To create Puppet manifests, it will be easier, but the required time to know the syntax is a problem for newbies. Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 4 / 23
  5. 5. Write Puppet manifests and modules faster with VIM: Introduction eNovance eNovance, an innovative French company that delivers services in two key areas: I Integrating and operating public and private open source clouds and 24/7 managed I Services for the world’s largest public clouds (Cloudwatt, AWS, Google Compute Engine, etc.). With its extensive investment in R&D, in less than three years eNovance has become the world’s 7th largest contributor to the OpenStack initiative, and the only European company on the foundation’s board of directors alongside Rackspace, Redhat, Cisco and HP. Today, we’re using Puppet in production and need to often write Puppet manifests and modules. That’s why we needed to have an IDE or something similar to win time when writing them. Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 5 / 23
  6. 6. Write Puppet manifests and modules faster with VIM: Introduction Plan 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 I Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 I History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 6 / 23
  7. 7. Write Puppet manifests and modules faster with VIM: Introduction History Puppet announced in 2011 an IDE plugin for Eclipse called Geppetto. I used it for more than a year and it really helps me to write manifests. Unfortunately, the latests versions purposed by Cloudsmith (Geppetto editor) get stability problems, even with the "all in one" version. In addition, Eclipse consume a lot of resources just for writing Puppet manifests. Another solution exist, this is set of VIM plugins which provide a lightweight solution. It gives more advanced features and automatically checks Puppet syntax (Geppetto too). This is what we’re going to see here with the usage. http://puppetlabs.com/blog/geppetto-a-puppet-ide/ http://cloudsmith.github.io/geppetto/ Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 7 / 23
  8. 8. Write Puppet manifests and modules faster with VIM: Setup and usage Plan 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Vundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Ultisnips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 I VIM Puppet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 I Tabular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 I Syntastic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 8 / 23
  9. 9. Write Puppet manifests and modules faster with VIM: Setup and usage Vundle What is Vundle ? Vundle is short for Vim bundle and is a Vim plugin manager. It will helps on install the next VIM modules (download and install from github/vimscripts...). To install it : Grab it from GitHub and add it to your vim personal folder git clone https :// github . com / gmarik / vundle .git ~/. vim / bundle / vundle To finish, add this at the beginning of your /.vimrc file : /.vimrc set nocompatible " be iMproved filetype off " required! set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " My Bundles here: Bundle ’gmarik/vundle’ " Additional bundles: filetype plugin indent on " required! Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 9 / 23
  10. 10. Write Puppet manifests and modules faster with VIM: Setup and usage Vundle When you will add new lines to declare new bundles, you’ll install them by running that command : Install bundles with vundle vim + BundleInstall + qall Link : https://github.com/gmarik/vundle Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 10 / 23
  11. 11. Write Puppet manifests and modules faster with VIM: Setup and usage Plan 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Vundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Ultisnips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 I VIM Puppet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 I Tabular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 I Syntastic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 11 / 23
  12. 12. Write Puppet manifests and modules faster with VIM: Setup and usage Ultisnips Ultisnips helps on writing Puppet type refences (file, cron, user...). To install it add this line after ’Additional bundle’ part of your vimrc and install this new bundle : .vimrc " Additional bundles: Bundle ’SirVer/ultisnips’ To test it, edit a file with ’.pp’ extension and type as follow : I class <tab> : you’ll see a class block I user <tab> : a block with most used option will appear I cron <tab> : a block ... I ... <tab> Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 12 / 23
  13. 13. Write Puppet manifests and modules faster with VIM: Setup and usage Ultisnips Here is the result : test.pp class name { # body } user { ’username’: ensure => present, uid => uid, gid => gid, comment => gecos, home => homedirectory, managehome => false, require => Group[’group’], } cron { ’name’: user => user, command => ’command’, minute => minute, hour => hour, } Link : https://github.com/SirVer/ultisnips Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 13 / 23
  14. 14. Write Puppet manifests and modules faster with VIM: Setup and usage Plan 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Vundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Ultisnips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 I VIM Puppet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 I Tabular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 I Syntastic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 14 / 23
  15. 15. Write Puppet manifests and modules faster with VIM: Setup and usage VIM Puppet VIM Puppet provides : I Formatting based on the latest Puppetlabs Style Guide I Syntax highlighting I Automatic => alignment (when the tabular plugin is also installed) To install it add this line after ’Additional bundle’ part of your vimrc and install this new bundle : /.vimrc " Additional bundles: Bundle ’rodjek/vim-puppet’ Link : https://github.com/rodjek/vim-puppet Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 15 / 23
  16. 16. Write Puppet manifests and modules faster with VIM: Setup and usage Plan 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Vundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Ultisnips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 I VIM Puppet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 I Tabular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 I Syntastic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 16 / 23
  17. 17. Write Puppet manifests and modules faster with VIM: Setup and usage Tabular This plugins helps on having signs alignments on multiple lines. It’s usually better to read good formated code. For instance having ’=’ sign aligned or ’=>’ sign for Puppet. Coupled with VIM Puppet, it will automatically align the signs when you will write your manifests. To install it add this line after ’Additional bundle’ part of your vimrc and install this new bundle : .vimrc " Additional bundles: Bundle ’godlygeek/tabular’ To use it with Puppet manifests/modules, you don’t have nothing to do as it will automatically align from the previous lines. Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 17 / 23
  18. 18. Write Puppet manifests and modules faster with VIM: Setup and usage Tabular Anyway, for any reasons you want to do it manually, this is easy. In VIM, place your cursor on the first line containing the symbol on which the alignment should be done, then type : This will align from the ’=’ symbol : Tabularize /= Example : toto = toto titi =titi toto = toto titi = titi Link : https://github.com/godlygeek/tabular Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 18 / 23
  19. 19. Write Puppet manifests and modules faster with VIM: Setup and usage Plan 2 Setup and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Vundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 I Ultisnips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 I VIM Puppet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 I Tabular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 I Syntastic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 19 / 23
  20. 20. Write Puppet manifests and modules faster with VIM: Setup and usage Syntastic Syntastic is a syntax checking plugin that runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn’t have to compile their code or execute their script to find them. To install it add this line after ’Additional bundle’ part of your vimrc and install this new bundle : .vimrc " Additional bundles: Bundle ’scrooloose/syntastic’ On the next slide, you’ll find a screenshot example. Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 20 / 23
  21. 21. Write Puppet manifests and modules faster with VIM: Setup and usage Syntastic Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 21 / 23
  22. 22. Write Puppet manifests and modules faster with VIM: Setup and usage Syntastic When you move your cursor on a line beginning with the ’»’ symbol, you’ll see the line error message on the bottom of the screen. If you want to see all errors, you need to type this in VIM : Install bundles with vundle : Errors And the bottom of the screen will look likes the screenshot above. Link : https://github.com/scrooloose/syntastic Pierre Mavro www.enovance.com Write Puppet manifests and modules faster with VIM 22 / 23

×