Testing the playbook

As we have all of the basic roles in place, we can try running the playbook; before doing so, we need to update the site.yml to include a play for our scan host:

---- hosts: scan  gather_facts: true  become: yes  become_method: sudo  vars_files:    - group_vars/common.yml  roles:    - roles/docker- hosts: wordpress  gather_facts: true  become: yes  become_method: sudo  vars_files:    - group_vars/common.yml  roles:    - roles/stack-install    - roles/stack-config    - roles/wordpress

Once updated, we can run our playbook using the code:

$ ansible-playbook -i production site.yml

This should give us something like the following output:

PLAY [scan] *************************************************************************************TASK [Gathering ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.