| Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
“Configuration management is the process of standardizing resource configurations and enforcing their state across IT infrastructure in an automated yet agile manner.”
- Puppet Labs
user { 'audience':
ensure => present,
}
Infrastructure as code is the act of describing what you want your servers to look like once, and using that to provision many machines to look the same.
It turns pets into cattle. (more on this difference later)
[ Puppet Site ]
packages [nginx, python, vim]
state installed
update true
service nginx
state enabled
alert service myapp_daemon
package "apache" do
package_name "httpd"
action :install
end
service "apache" do
action [:enable, :start]
end
Note
Since chef uses Ruby you can do loops and other cool Ruby-isms in your configuration management. This can be a gift and a curse.
package { "apache":
name => "httpd",
ensure => present,
}
service { "apache":
name => "apache",
ensure => running,
enable => true,
require => Package["apache"],
}
Note
Since Puppet designed it’s own language for Configuration managent you are more limited in what you can express with Puppet, but this isn’t always a bad thing. It’s feature rich and can do pretty much anything Chef can.
- hosts: all
tasks:
- name: Install Apache
yum:
name: httpd
state: present
- name: Start Apache Service
service:
name: httpd
state: running
enabled: yes
Note
Ansible’s langauge is Yaml, which is basically JSON but easier to read and write. This is similar to Puppet in it limits the possible functionality, but again: these tools all achieve the same result, they just get there in different ways.
$ pip install ansible