What is puppet
- Infrastructure automation and configuration management tool.
- Enforces the defined state of the infrastructure
- Can automate tasks on thousands of machines
- Enables infrastructure as code
- Allows configuration consistency across nodes
- Enables quick provisioning of new machines in new environments
- Allows DevOps admins to write declarative instructions using the puppet language
- Code is written inside of classes and classes are assigned to node
- Puppet is written in Ruby Language.
- Acceptance testing can be done by Beaker, a product developed by puppet.
- Fundamentally what all we are doing with puppet is managing resources on a large and automated scale while caring as little as possible about the platform and distribution.
Definitions & Features
- Puppet Nodes: Nodes are any virtual or physical system that is able to run puppet agent and is specifically supported by puppet agent.
Puppet has puppet.conf file:
- This the main config file, which contains 4 sections, main, master, agent and user.
- Settings are loaded at service start time.
- In agent section, you can define runinterval, which tells puppet how often agent daemon runs.
- In puppet you have resources. Every resource is an instance of resource type.
- Resource types can be: file, package, service, .
- A system configuration is a collection of resources.
- A catalog in puppet describes the desired state for each resource on a system.
- Puppet doesn't enforce resources from top down, instead on dependency relationships.
Resource meta parameters can be applied on any resource type.
- Require (need a referenced resource to be applied first;
- Before(request to be applied before a referenced resource)
- Subscribe(listen for puppet changes)
- Notify (send a notification when puppet changes the containing resource)
- Other: schedule, alias, audit, noop, loglevel, tag.
- You define variables with $var in puppet; Three scopes for variables: Top, node, class. Puppet always finds the closest scope to the code being executed.
- Profiles are a grouping of technology configurations and class declarations.
- Role is based on a business function. I.e., webserver, database server etc.,
- Puppet module is a command used to help manage building and downloading modules from the puppet forge .