2012-06-18 18:30:07 -04:00
|
|
|
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
|
|
|
|
#
|
2013-06-20 17:39:31 -04:00
|
|
|
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
|
2012-06-18 18:30:07 -04:00
|
|
|
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
|
|
|
|
|
2013-09-15 11:21:02 -04:00
|
|
|
# Header to match http://docs.puppetlabs.com/guides/style_guide.html#puppet-doc
|
|
|
|
snippet classheader
|
|
|
|
# == Class: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'name')`}
|
|
|
|
#
|
|
|
|
# ${2:Full description of class $1 here}
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
|
|
|
# Document parameters here.
|
|
|
|
#
|
|
|
|
# [*parameter1*]
|
|
|
|
# Explanation of what this parameter affects and what it defaults to.
|
|
|
|
# e.g. "Specify one or more upstream ntp servers as an array."
|
|
|
|
#
|
|
|
|
# === Variables
|
|
|
|
#
|
|
|
|
# Here you should define a list of variables that this module would require.
|
|
|
|
#
|
|
|
|
# [*variable1*]
|
|
|
|
# Explanation of how this variable affects the funtion of this class and
|
|
|
|
# if it has a default. e.g. "The parameter enc_ntp_servers must be set by the
|
|
|
|
# External Node Classifier as a comma separated list of hostnames."
|
|
|
|
#
|
|
|
|
# === Examples
|
|
|
|
#
|
|
|
|
# class { '$1':
|
|
|
|
# parameter1 => [ 'just', 'an', 'example', ]
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# === Authors
|
|
|
|
#
|
|
|
|
# `g:snips_author` <`g:snips_email`>
|
|
|
|
#
|
|
|
|
# === Copyright
|
|
|
|
#
|
|
|
|
# Copyright `strftime("%Y")` `g:snips_author`
|
|
|
|
#
|
|
|
|
class $1 (${3}){
|
|
|
|
${4}
|
|
|
|
}
|
|
|
|
|
|
|
|
snippet defheader
|
|
|
|
# == Define: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:r:s?/manifests/?::?'), 'name')`}
|
|
|
|
#
|
|
|
|
# ${2:Full description of defined resource type $1 here}
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
|
|
|
# Document parameters here
|
|
|
|
#
|
|
|
|
# [*namevar*]
|
|
|
|
# If there is a parameter that defaults to the value of the title string
|
|
|
|
# when not explicitly set, you must always say so. This parameter can be
|
|
|
|
# referred to as a "namevar," since it's functionally equivalent to the
|
|
|
|
# namevar of a core resource type.
|
|
|
|
#
|
|
|
|
# [*basedir*]
|
|
|
|
# Description of this variable. For example, "This parameter sets the
|
|
|
|
# base directory for this resource type. It should not contain a trailing
|
|
|
|
# slash."
|
|
|
|
#
|
|
|
|
# === Examples
|
|
|
|
#
|
|
|
|
# Provide some examples on how to use this type:
|
|
|
|
#
|
|
|
|
# $1 { 'namevar':
|
|
|
|
# basedir => '/tmp/src',
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# === Authors
|
|
|
|
#
|
|
|
|
# `g:snips_author` <`g:snips_email`>
|
|
|
|
#
|
|
|
|
# === Copyright
|
|
|
|
#
|
|
|
|
# Copyright `strftime("%Y")` `g:snips_author`
|
|
|
|
#
|
|
|
|
define $1(${3}) {
|
|
|
|
${4}
|
|
|
|
}
|
|
|
|
|
2012-06-18 18:30:07 -04:00
|
|
|
# Language Constructs
|
|
|
|
snippet class
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`vim_snippets#Filename('', 'name')`} {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
snippet node
|
2013-07-07 21:41:11 -04:00
|
|
|
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
snippet case
|
|
|
|
case $${1:variable} {
|
2013-07-25 17:17:32 -04:00
|
|
|
default: { ${0} }
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
snippet ife
|
|
|
|
if $${1:variable} {
|
|
|
|
${2}
|
|
|
|
} else {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
snippet if
|
|
|
|
if $${1:variable} {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2013-06-20 17:39:31 -04:00
|
|
|
}
|
2013-06-22 20:30:26 -04:00
|
|
|
snippet el
|
2012-06-18 18:30:07 -04:00
|
|
|
else {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
snippet ?
|
|
|
|
? {
|
2013-07-25 17:17:32 -04:00
|
|
|
'${1}' => ${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
2013-06-20 17:39:31 -04:00
|
|
|
#
|
2012-06-18 18:30:07 -04:00
|
|
|
# blocks etc and general syntax sugar
|
|
|
|
snippet [
|
2013-07-25 17:17:32 -04:00
|
|
|
[ ${1} ]
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet >
|
2013-07-25 17:17:32 -04:00
|
|
|
${1} => ${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet p:
|
2013-07-25 17:17:32 -04:00
|
|
|
"puppet://puppet/${1:module name}/${0:file name}"
|
2012-06-18 18:30:07 -04:00
|
|
|
#
|
|
|
|
# Functions
|
|
|
|
snippet alert
|
2013-07-25 17:17:32 -04:00
|
|
|
alert("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet crit
|
2013-07-25 17:17:32 -04:00
|
|
|
crit("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet debug
|
2013-07-25 17:17:32 -04:00
|
|
|
debug("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet defined
|
2013-07-25 17:17:32 -04:00
|
|
|
defined(${1:Resource}["${2:name}"])
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet emerg
|
2013-07-25 17:17:32 -04:00
|
|
|
emerg("${1:message}")
|
2013-06-20 17:39:31 -04:00
|
|
|
snippet extlookup Simple extlookup
|
2013-07-25 17:17:32 -04:00
|
|
|
extlookup("${1:variable}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet extlookup Extlookup with defaults
|
2013-07-25 17:17:32 -04:00
|
|
|
extlookup("${1:variable}", "${2:default}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet extlookup Extlookup with defaults and custom data file
|
2013-07-25 17:17:32 -04:00
|
|
|
extlookup("${1:variable}", "${2:default}", "${3:data source}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet fail
|
2013-07-25 17:17:32 -04:00
|
|
|
fail("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet info
|
2013-07-25 17:17:32 -04:00
|
|
|
info("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet inline_template
|
2013-07-25 17:17:32 -04:00
|
|
|
inline_template("<%= ${1} %>")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet notice
|
2013-07-25 17:17:32 -04:00
|
|
|
notice("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet realize
|
2013-07-25 17:17:32 -04:00
|
|
|
realize(${1:Resource}[${2:name}])
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet regsubst
|
2013-07-25 17:17:32 -04:00
|
|
|
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet inc
|
2013-07-25 17:17:32 -04:00
|
|
|
include ${1:classname}
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet split
|
2013-07-25 17:17:32 -04:00
|
|
|
split(${1:hay stack}, "${2:patten}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet versioncmp
|
2013-07-25 17:17:32 -04:00
|
|
|
versioncmp("${1:version}", "${2:version}")
|
2012-06-18 18:30:07 -04:00
|
|
|
snippet warning
|
2013-07-25 17:17:32 -04:00
|
|
|
warning("${1:message}")
|
2012-06-18 18:30:07 -04:00
|
|
|
#
|
|
|
|
# Types
|
|
|
|
snippet cron
|
|
|
|
cron{ "${1:name}":
|
|
|
|
command => "${2}",
|
|
|
|
user => "${3:root}",
|
2013-07-25 17:17:32 -04:00
|
|
|
${4} => ${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet exec
|
|
|
|
exec{ "${1:name}":
|
|
|
|
command => "${2:$1}",
|
|
|
|
user => "${3:root}",
|
2013-07-25 17:17:32 -04:00
|
|
|
${4} => ${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet user
|
|
|
|
user{ "${1:user}":
|
|
|
|
comment => "${2:$1}",
|
|
|
|
ensure => present,
|
|
|
|
managehome => true,
|
2013-07-25 17:17:32 -04:00
|
|
|
home => "${0:/home/$1}"
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet group
|
|
|
|
group{ "${1:group}":
|
2013-07-25 17:17:32 -04:00
|
|
|
ensure => ${0:present}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet host
|
|
|
|
host{ "${1:hostname}":
|
2013-07-25 17:17:32 -04:00
|
|
|
ip => ${0:127.0.0.1}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet mailalias
|
|
|
|
mailalias{ "${1:localpart}":
|
2013-07-25 17:17:32 -04:00
|
|
|
recipient => "${0:recipient}"
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet mount
|
|
|
|
mount{ "${1:destination path}":
|
|
|
|
ensure => ${2:mounted},
|
2013-07-25 17:17:32 -04:00
|
|
|
device => "${0:device name or path}"
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet package
|
|
|
|
package{ "${1:package name}":
|
2013-07-25 17:17:32 -04:00
|
|
|
ensure => ${0:present}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet yumrepo
|
|
|
|
yumrepo{ "${1:repo name}":
|
|
|
|
descr => "${2:$1}",
|
2013-07-25 17:17:32 -04:00
|
|
|
enabled => ${0:1}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet define
|
|
|
|
define ${1} (${2}) {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet service
|
|
|
|
service{ "${1:service}":
|
|
|
|
enable => ${2:true},
|
2013-07-25 17:17:32 -04:00
|
|
|
ensure => ${0:running},
|
2012-06-18 18:30:07 -04:00
|
|
|
hasstatus => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
snippet file
|
|
|
|
file{ "${1:path}":
|
2013-07-25 17:17:32 -04:00
|
|
|
${2} => ${0}
|
2012-06-18 18:30:07 -04:00
|
|
|
}
|
|
|
|
|