Build a Site
Build a holistic configuration, a Site, for our environment.
We'll cover the following
Your environment consists of:
- One Nginx server
- One IIS server
As changes flow through your environment, you will be required to run one of the two playbooks:
configure_iis_web_server.yml
configure_nginx_web_server.yml
Before you make the change, you have to decide which playbook to run. Making this decision is problematic: it requires manual intervention, and it doesn’t take advantage of Ansible’s idempotency.
Another option is to combine the two playbooks, running them both any time there is a change. What makes this operation safe is that the tasks within the playbooks are themselves idempotent. Luckily, there is a better option to use a site playbook than copying the tasks into a single monolithic playbook.
Site
Site is a term used in Ansible’s documentation to define the holistic configuration of an application, service, or environment.
It is a playbook that determines the configuration by listing the sequence of Ansible automation to run.
In this scenario, you will use a site.yml
playbook to import the existing playbooks, allowing you to run both at once.
You will create a site.yml
playbook to configure the web servers.
Get hands-on with 1200+ tech skills courses.