Code Monkey home page Code Monkey logo

ansiblefest-demo's Introduction

AnsibleFest 2020 - NGINX: Better with Ansible Demo

Overview

This demo uses Terraform to set up four instances on AWS and then provides a series of Ansible playbooks to install NGINX Plus, configure an NGINX Plus reverse proxy load balancing between a couple NGINX Plus web servers, and install NGINX App Protect and configure NGINX App Protect to secure the NGINX Plus reverse proxy.

Requirements

Terraform

This demo has been developed and tested with Terraform 0.13.

Instructions on how to install Terraform can be found in the Terraform website.

Ansible

This demo has been developed and tested with maintained versions of Ansible bigger than 2.9.10. Backwards compatibility is not guaranteed.

Instructions on how to install Ansible can be found in the Ansible website.

Guide

Before running any playbooks you need to deploy the required AWS infrastructure using Terraform.

You can then run the sample playbooks provided to install and configure NGINX Plus and NGINX App Protect.

Terraform

To use the provided Terraform scripts, you need to:

  1. Export your AWS credentials as environment variables (or alternatively, tweak the AWS provider in terraform/provider.tf).
  2. If you wish to deploy your AWS infrastructure in a different region than the default, us-west-1, you will need to tweak the region and ami variables present in terraform/variables.tf.

Once you have configured your Terraform environment, you can either:

  • Run ./setup.sh to initialize the AWS Terraform provider and start a Terraform deployment on AWS.
  • Run terraform init and terraform apply from within the terraform directory.

And finally, once you are done playing with the Ansible playbooks provided, you can destroy the AWS infrastructure by either:

  • Run ./cleanup.sh to destroy your Terraform deployment.
  • Run terraform destroy from within the terraform directory.

Ansible

You can find the playbooks included in the demo in the playbooks/ folder. Playbooks two through four can be deployed in any order, albeit the recommended order gradually configures a more advanced NGINX environment. You will have to deploy playbook one, 1-deploy-nginx.yml, before you attempt to deploy any other playbooks.

You can also find an AWS inventory plugin playbook in playbooks/aws_ec2.yml. This plugin will find the instances deployed by Terraform and save them in a temporary inventory list. You can tweak the plugin to your liking with the exception of the filters and keyed_groups (these are necessary for the Ansible playbooks to work correctly).

To execute a playbook, run:

ansible-playbook -i playbooks/aws_ec2.yml playbooks/1-deploy-nginx.yml

This demo includes the following playbooks:

Name Description
0-check-platform.yml Check that all platforms have been deployed correctly by Terraform
1-deploy-nginx.yml Deploy NGINX Plus
2-deploy-nginx-web-server.yml Deploy an NGINX Plus web server
3-deploy-nginx-web-server-proxy.yml Deploy an NGINX Plus reverse proxy load balancing between two NGINX Plus web servers
4-deploy-nginx-app-protect-web-server-proxy.yml Deploy an NGINX Plus reverse proxy load balancing between two NGINX Plus web servers protected by NGINX App Protect
5-check-app-protect.yml Check that NGINX App Protect is working as expected

Author Information

Alessandro Fael Garcia

ansiblefest-demo's People

Contributors

alessfg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.