Before we finish this chapter and move on to installing Ansible, let's quickly discuss infrastructure as code, first of all by looking at some actual code. The following bash script installs several RPMs using the yum package manager:
#!/bin/shLIST_OF_APPS="dstat lsof mailx rsync tree vim-enhanced git whois iptables-services"yum install -y $LIST_OF_APPS
The following is a Puppet class that does the same task as the previous bash script:
class common::apps { package{ [ 'dstat', 'lsof', 'mailx', 'rsync', 'tree', 'vim-enhanced', 'git', 'whois', 'iptables-services', ]: ensure => installed, }}
Next up, we have the same task using SaltStack:
common.packages: pkg.installed: - pkgs: - dstat - lsof - mailx - rsync - tree - vim-enhanced ...