devops work

Puppet tips

I don’t like puppet, I grew up with Chef, though Puppet is as good as Chef.
When programming a new puppet manifest I always start with logical structure, I test this structure using notify commands.

Puppet has a DSL, it’s not ruby, it’s not a “normal” language. For example there are no variables. There are constants, they look like variables though they are not mutable.

Puppet code is build out of Resource statements. There are many resources available, each one has it’s own parameters though syntax is very similar. notice that the syntax of the notify resource.

notify {'some message':}

Removing Resources

As time goes by there you may find the need to replace a resource, a new service, a cronjob that is irrelevant now. In order to remove the old one all you need is to state it, just set the ensure parameter to absent. This will remove the resource from the target machine

<some resource> {'<resource_name>':
ensure  => absent
.
.
.
}

Path is missing…
puppet creates only one resource at a time, so if a directory path is not fully created, need to create the entire path… so if you wish to add the path /tmp/test/1 and only /tmp directory exists, you need to create the test and 1 directories.

File { ['/tmp/test','/tmp/test/1']:
		ensure => directory
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.