Ansible, Puppet, & Chef
Synchronized Transcript
88 cues indexed • Click dialogue or words to jumpWelcome to Jeremy’s IT Lab. This is a free, complete course for the CCNA. If you like these videos, please subscribe to follow along with the series.
Also, please like and leave a comment, and share the video to help spread this free series of videos. Thanks for your help. In this video we will cover configuration management tools Ansible, Puppet, and Chef.
They are exam topic 6.6, which says you must be able to recognize the capabilities of configuration management mechanisms. So, just like with the other automation topics on the CCNA, you don’t have to actually be able to use these tools yet, but Cisco expects you to have a basic understanding of their purpose and capabilities.
Here’s what we’ll cover in this video. First I’ll introduce configuration management tools, what they are and why we use them.
Then I’ll introduce some of the characteristics of the configuration management tools Ansible, Puppet, and Chef. So far I’ve introduced various automation tools, and I just want to say that these are just tools.
They are suitable for some jobs, and not suitable for others. Depending on the company you work for and its size, they might use a lot of different automation tools, or just a few of them, or none at all.
Configuration management tools like these three can be useful in any network, but especially in medium to large networks with hundreds or even thousands of devices.
And make sure to watch until the end of the video for a bonus practice question from Boson Software’s ExSim, the best practice exams for the CCNA.
To understand one reason why configuration management tools are useful, let me explain the concept of configuration drift. Configuration drift is when individual changes made over time cause a device’s configuration to deviate from the standard and correct configurations as defined by the
company. This is not a good thing, and should be avoided wherever possible. I mentioned this earlier in the course, but each device in a network typically doesn’t have a totally unique configuration.
Although each device will have unique parts of its configuration, for example IP addresses and its host name, most of a device’s configuration is usually defined in standard templates designed by the network architects or engineers of the company.
For example, you can expect all of your routers to have the same SNMP configurations, the same Syslog configurations, the same AAA configurations for logging in, one or two WAN interfaces, one or two LAN interfaces, etc.
Those all follow standard templates, with just a few unique configurations for each device. But, as individual engineers make changes to devices, for example to troubleshoot and fix network issues, test configurations, etc, the configuration of a device can drift away from the standard.
Often records of these individual changes and their reasons aren’t kept, and this can lead to issues in the future. For example, it might be hard to tell if a certain configuration is necessary when looking at it a few years later.
The configuration management tools we’ll look at today can help with this, but even without automation tools like Ansible, it is best to have standard configuration management practices.
For example, something I did in the past was when a change is made, save the config as a text file and place it in a shared folder. In my case, a standard file naming system hostname_year month day was used.
Notice in the screenshot here we have three different versions of R1’s config from three different dates, and three versions of R2’s config as well. This helps keep track of previous versions of the config and see when changes were made.
However there are flaws to this system, as an engineer might simply forget to place the new config in the folder after making changes. In that case, which one should be considered the correct config?
And even if the configurations are properly saved in a folder like this, it doesn’t guarantee that the configurations actually match the standard. It just helps us keep track of different versions of the config.
Plus, a manual approach is not very scalable in networks with hundreds of devices. So, configuration management tools can of course help us with the issues I just mentioned like preventing configuration drift, but they can also assist us in configuration provisioning.
Configuration provisioning refers to how configuration changes are applied to devices. This includes configuring new devices too, so not just making changes to current devices.
As you know, traditionally configuration provisioning is done by connecting to devices one-by-one via SSH, or console as well of course. But this is not practical in large networks.
It simply doesn’t scale well in networks with hundreds or thousands of devices. Configuration management tools like Ansible, Puppet, and Chef allow us to make changes to devices on a mass scale with a fraction of the time and effort.
Two essential components that you’ll find in all of these tools are templates and variables. Here’s an example of a template, where values aren’t given for things like the hostname, IP address, mask, OSPF process ID, and area.
Instead, we use a separate file specifying the variables for a specific device, R1 in this case. Given a template and the appropriate variables, a config is generated and sent to the device.
Of course, this is just a small snippet of a configuration, but I think you can see how easy it would be to generate the configuration of many devices at once. All devices can share the template, and we just need to specify some variables like hostnames, IP addresses, etc.
Exactly how these templates and variables are managed is different depending on the tool, but they all use a system like this. Okay now let me introduce configuration management tools.
These are network automation tools that facilitate the centralized control of large numbers of network devices. They can be useful in networks of any size, but typically they’re used in larger networks.
The options you need to be aware of for the CCNA are Ansible, Puppet, and Chef. When it comes to managing network devices, that’s also the order of their popularity.
Ansible first, Puppet second, and Chef third. However, these tools weren’t originally developed for the management of network devices. They were originally developed after the rise of VMs, to enable server system admins to automate the process of creating, configuring, and removing VMs.
But these days they are also widely used to manage network devices, especially Ansible. They can be used to perform tasks such as generate configurations for new devices on a large scale.
Using templates it’s very simple to generate a new configuration for a new device, it’s just a bit of copy and paste. They can be used to perform configuration changes on devices.
It can be all devices in your network, or a certain subset of devices, or just one device. You tell Ansible or Puppet or Chef which changes you want to make on which devices, and it does the rest of the work for you.
These tools can also be used to check device configurations for compliance with defined standards. If a device’s configuration doesn’t match the standard, an alert could be sent out, for example.
Then you can investigate that issue and fix it, to make the configuration comply with the standard again. Or you can automate the change. You can also compare configurations between devices, and between different versions of configurations on the same device.
These are just some examples of what you can do with these tools. Basically, they solve the problem of managing the configurations of devices in networks with hundreds or thousands of different devices.
Now let’s take a look at the basic characteristics of each of these three tools. First up, Ansible. Ansible is a configuration management tool owned by Red Hat, famous for Red Hat Linux.
Ansible itself is written in Python. The other two I’ll introduce, Puppet and Chef, are written in a different language, Ruby. Ansible is agentless.
So, what does that mean? It means that it doesn’t require any special software to run on the managed devices. Instead, Ansible simply uses SSH to connect to devices, make configuration changes, extract information, etc.
This is a big advantage of Ansible which makes it very versatile, and it’s probably the reason that it is the most popular choice for network device configuration management.
Ansible also uses what’s called a push model. The Ansible server, also called the control node, uses SSH to connect to managed devices and push configuration changes to them.
This is different than Puppet and Chef which use a pull model, in which the managed devices connect to the server to receive their configurations. After installing Ansible, you must create several text files that it can use.
Playbooks are the ‘blueprint’ of automation tasks. They outline the logic and actions of the tasks that Ansible should do, and these playbooks are written in YAML.
Then you’ll also need inventory files which list the devices that will be managed by Ansible, as well as their characteristics. For example, their device role such as access switch, core switch, WAN router, firewall etc can be listed as a characteristic.
These inventory files can be written in multiple formats, such as INI or YAML. You also need templates, which as you saw earlier represent a device configuration file, but specific values for variables are not provided, for example the host name and IP addresses.
These templates are written in a format called Jinja2. And finally you’ll need variable files. They list variables and their values, as you also saw earlier.
These values are substituted into the templates to create complete configuration files, and these files are written in YAML. Let’s look at a diagram to visualize how this works.
So, here we have our inventory, templates, variables, and playbook. The inventory provides a list of devices, the template files provide configuration templates for the devices, and the variables provide specific variables and their values.
These inputs are given to the playbook which takes the necessary actions to push the config to the managed devices. Okay, that’s all for Ansible. You should know that it is agentless, written in Python, uses a push model, uses SSH to connect to devices, and uses YAML
for its necessary files. Next up, Puppet. Puppet is a configuration management tool written in the programming language Ruby. It is typically agent-based, which means that specific software, a Puppet agent, must be installed on the managed devices.
And not all Cisco devices support a Puppet agent, which is a major reason that Ansible is more popular for network device management. However it can be run agentless, in which a proxy agent runs on an external host and the proxy agent uses SSH to connect to the managed devices and communicate
with them. Note that in Puppet the server is called the Puppet master. And Puppet uses a pull model, so clients pull configurations from the Puppet master instead of the Puppet master pushing configurations to them.
And note that clients use TCP 8140 to communicate with the Puppet master. You probably should remember that port number. And instead of YAML, it uses a proprietary language for its files.
Like Ansible it requires some different text files on the Puppet master, for example a Manifest file defines the desired configuration state of a network device.
The Puppet master then uses this Manifest to generate specific configurations for the managed devices. And just like Ansible, templates are used too, in this case to help generate Manifests for the devices.
Here’s a very simplified look at that. Note that some of the devices have a Puppet agent installed which provides a REST API to communicate with the device, but one doesn’t.
Instead it will communicate via the external agent. In both cases, the network devices are able to pull configurations from the Puppet master.
Okay, that’s Puppet. Remember that it’s written in Ruby, is typically agent-based, the server is called the Puppet master, it uses a pull model, clients use TCP 8140 to communicate with the Puppet master, it uses a proprietary language for its files instead of YAML, and uses
Manifests to define the desired configuration state of devices. Those are the main points you should know about Puppet. Finally let’s look at Chef.
Like Puppet, it is a configuration management tool written in Ruby. It is agent-based, so specific software, a Chef agent, must be installed on the managed devices.
And not all Cisco devices support a Chef agent, in fact most don’t. So, this is the least popular of the three choices. Like Puppet, Chef also uses a Pull model.
And the Chef server uses TCP port 10002 to send configurations to clients. It uses various other ports, too, but you should remember 10002. And Chef’s files use a DSL, Domain-Specific Language, which is based on Ruby.
So, what are some of those files used by Chef. We have resources, which are like the ingredients in a recipe. They define configuration objects managed by Chef.
A configuration object could be, for example, a set of configuration commands. Then there are recipes, like the recipes in a cookbook. They outline the logic and actions of the tasks performed on the resources.
And of course there are cookbooks too, sets of related recipes grouped together. And finally run-lists, which are an ordered list of recipes that are run to bring a device to the desired configuration state.
And here’s a diagram from the Chef website demonstrating the architecture. Admins will do their work on a Chef workstation, a computer they use to prepare cookbooks, recipes, etc.
Required information is stored on a Chef server, and the managed devices, the Chef clients, communicate with the Chef server. Notice that possible clients include servers, storage devices, virtual platforms, public clouds, and of course network devices.
As mentioned earlier, these tools weren’t designed specifically for network devices, and they can be used for various purposes. So, that’s Chef.
Remember that it is written in Ruby, is agent-based, uses a pull model, uses TCP 10002 to send configurations, and its files such as cookbooks use a language based on Ruby.
And finally, here’s a chart comparing the three. Something I didn’t mention clearly is that Puppet and Chef both communicate using HTTP, via their REST APIs.
I recommend memorizing these basic characteristics as shown in the chart, you may be tested on them. Okay, here’s what we covered in this video.
I introduced configuration management tools and what we use them for. And then I introduced three that you should know for the CCNA: Ansible, Puppet, and Chef.
We only covered some very basic characteristics of each of them, but that’s all you need to know for the CCNA. As you continue your studies you’ll probably get some hands on experience with these tools, especially Ansible, but for now you just need to know the basics.
And make sure to watch until the end of the quiz for a bonus practice question from Boson Software’s ExSim, the best practice exams for the CCNA. Okay, let’s go to quiz question 1.
Which of the following configuration management tools connects to devices using SSH? Pause the video now to select the best answer.
Okay, the answer is B, Ansible. Ansible is agentless, so the control node simply connects to managed devices using SSH.
Now, a Puppet external agent also connects to devices using SSH, but standard Puppet architecture does not, so Ansible is definitely the better answer here.
Okay, let’s go to question 2. Which of the following configuration management tools use a pull model? Select all that apply.
Pause the video now to select the best answers. Okay, the answers are A, Chef and C, Puppet.
They both use a pull model, whereas Ansible uses a push model. Okay, let’s go to question 3. Which of the following configuration management tools use a client-server model?
Pause the video now to select the best answer. Okay, the answer is D, all of the above.
Now, in this video I didn’t explicitly state that Ansible, Puppet, or Chef use a client-server model, but in describing their operations I mentioned servers and clients.
Okay, let’s go to question 4. Which of the following configuration management tools are written in Ruby? Select all that apply.
Pause the video now to select the best answers. Okay, the answers are A, Chef and C, Puppet.
Both of these tools are written in Ruby, whereas Ansible is written in Python. Okay, let’s go to question 5.
Which of the following configuration management tools uses playbooks? Pause the video now to select the best answer.
Okay the answer is B, Ansible. Ansible playbooks are the blueprints of automation tasks. They outline the logic and actions of the tasks that Ansible should perform.
Okay, that’s all for the quiz. Now let’s try a bonus question from Boson Software’s ExSim for CCNA.