Using Ansible to orchestrate software installations across multiple instances
So far, we created playbooks that first launched an instance, and then we extended this in the previous recipe to subsequently install Apache onto the running instance. This recipe describes a playbook that can launch any number of instances, and install Apache onto each of those instances.
Getting ready
Ensure that you are logged on to a correctly configured OpenStack client and can access the OpenStack environment that has Ansible installed.
How to do it...
We will extend the previous recipe's playbook to add flexibility to include a variable number of instances.
The basic structure was provided in the previous recipe, so the only play we need to adjust is the first one that launches the instances, called
Launch instances on OpenStack
. This complete play is shown as follows, where we introduce a variable calledcount
, which we have set to2
, and we also introduce thewith_sequence
section, which forms our loop that...