The next file we are going to change is the site.yml one. This file needs to be updated to run the roles both locally and also against the Droplet we have launched:
---- name: Launch the droplet in DigitalOcean hosts: localhost connection: local gather_facts: True vars_files: - group_vars/common.yml roles: - roles/droplet- name: Install WordPress on the droplet hosts: digitalocean gather_facts: true vars_files: - group_vars/common.yml roles: - roles/stack-install - roles/stack-config - roles/wordpress
Our updated site.yml file contains two different plays: the first one runs on our Ansible controller and interacts with the DigitalOcean API to launch a Droplet, the second play then connects to the hosts in the digitalocean group ...