NGINX.COM
Web Server Load Balancing with NGINX Plus

Please note that NGINX ModSecurity WAF officially went End-of-Sale as of April 1, 2022 and is transitioning to End-of-Life effective March 31, 2024. For more details please read this blog announcement.

NGINX, Inc. has been hard at work following the release of the original, separate Ansible roles for NGINX Open Source and NGINX Plus. We are now releasing a new, unified NGINX Ansible role.

This new Ansible role replaces the previous separate Ansible roles, which are no longer being maintained or updated. We will continue to develop the new Ansible role to support customer use cases as they change.

The new Ansible role can install either NGINX Open Source or NGINX Plus and has additional features, including:

The new NGINX Ansible role is hosted at Ansible Galaxy, a free site for sharing, finding, and downloading roles. Downloading Ansible roles from Ansible Galaxy is a great way to jump‑start your automation projects.

Installing the new NGINX Ansible role from Ansible Galaxy is very simple. Run:

$ ansible-galaxy install nginxinc.nginx

You can then deploy NGINX or NGINX Plus on a local machine with a simple Ansible playbook:

---
- hosts: localhost
  remote_user: root
  roles:
    - nginxinc.nginx

You can also configure Ansible to deploy to a cloud provider using a dynamic inventory. For sample instructions for an AWS EC2 inventory, see the AWS blog.

For example, the following playbook deploys NGINX to a dynamic inventory containing the user_ubuntu tag:

---
- hosts: tag_user_ubuntu
  become: true
  remote_user: ubuntu
  roles:
    - nginxinc.nginx

Deploying NGINX Plus within a cloud provider additionally requires you to define the location of the certificate and key for your NGINX Plus subscription. The recommended pathway for the license is the files subfolder within the NGINX Ansible role. To use a different location, specify it using Ansible variables.

---
- hosts: tag_user_ubuntu
  become: true
  remote_user: ubuntu
  roles:
    - nginxinc.nginx
  vars:
    type: plus
    license:
      certificate: /path/to/certificate
      key: /path/to/key

For more details, including the list of variables you can specify, visit the GitHub repository for the NGINX Ansible role. We also welcome your questions and contributions on GitHub.

Please note that NGINX ModSecurity WAF officially went End-of-Sale as of April 1, 2022 and is transitioning to End-of-Life effective March 31, 2024. For more details please read this blog announcement.

Hero image
Managing Kubernetes Traffic with F5 NGINX: A Practical Guide

Learn how to manage Kubernetes traffic with F5 NGINX Ingress Controller and F5 NGINX Service Mesh and solve the complex challenges of running Kubernetes in production.

About The Author

Alessandro Fael Garcia

Alessandro Fael Garcia

Technical Marketing Engineer

About F5 NGINX

F5, Inc. is the company behind NGINX, the popular open source project. We offer a suite of technologies for developing and delivering modern applications. Together with F5, our combined solution bridges the gap between NetOps and DevOps, with multi-cloud application services that span from code to customer.

Learn more at nginx.com or join the conversation by following @nginx on Twitter.