Search⌘ K
AI Features

Build a Site

Explore how to build a site playbook in Ansible that combines existing server configuration playbooks for Nginx and IIS. Understand using import_playbook to link reusable playbooks, manage host groups properly, and centralize automation to reduce manual intervention and configuration drift.

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, ...