A demo Chef cookbook that sets up Apache httpd on a CentOS machine.
The cookbook includes three recipes:
recipe[httpd::default]
— installs and starts only the corehttpd
stuff. No HTTPS will be available.recipe[httpd::ssl]
— meant to be used after thedefault
recipe. Installsmod_ssl
, places a certificate from a data bag item and a private key from a Chef Vault item. By default it retrieves the certficate from an item named#{node.name}
(server hostname) inside thecertificates
data bag. It fetches the private key from a Chef Vault item named#{node.name}
(server hostname) from the data bagprivate_keys
.recipe[httpd::remove]
— ensures that everything created bydefault
andssl
recipes are removed.
There are three Test Kitchen scenarios tested with InSpec:
- default:
default
recipe (without HTTPS) - https:
default
+ssl
recipes - remove: provisions the https scenario and uninstalls everything afterwards
See it run:
$ chef exec kitchen test default
$ chef exec kitchen test https
$ chef exec kitchen test remove
$ chef exec rspec