LAMP stack playbook example – combining all the concepts

We will look at how to write a LAMP stack playbook using the skills we have learned so far. Here is the high-level hierarchy structure of the entire playbook:

inventory               # inventory filegroup_vars/             #   all.yml              # variablessite.yml                # master playbook (contains list of roles)roles/                  #    common/             # common role        tasks/          #            main.yml    # installing basic tasks    web/                # apache2 role        tasks/          #            main.yml    # install apache        templates/      #            web.conf.j2 # apache2 custom configuration        vars/           #             main.yml    # variables for web role         handlers/       #            main.yml    # start apache2    php/                # php role        tasks/          #             main.yml    # installing php and restart apache2    db/                 # db role        tasks/          #            main.yml    # install mysql and include harden.yml harden.yml # ...

Get Security Automation with Ansible 2 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.