It’s the Year of Ansible at NGINX.
We believe in an app‑centric approach to application delivery that enables intelligent scaling of apps at the point of a bottleneck, eliminating the need to scale infrastructure across the entire app. Key in making this approach a reality is the vast ecosystem of CI/CD tools used by developers. As one of the most popular automation tools, Ansible enables NGINX users to quickly automate repetitive tasks across the app lifecycle. That’s why we’ve made a major investment in building out more Ansible roles and collections to enable easy automation of your NGINX environment. Over the last five years, we’ve grown our Ansible integration from a single blog post to two certified collections and 20+ roles – most of which were created in the last 9 months!
Why Use Ansible to Provision NGINX?
There are several excellent reasons to use Ansible to provision NGINX:
- You are probably already an Ansible user – and if not, you are at least seriously considering giving Ansible a try. Otherwise, you wouldn’t be here!
- Decentralized, resilient, and redundant multi‑cloud deployments are becoming more and more common. Ansible gives you the tooling you need to easily install and configure NGINX software across multiple target hosts.
- By using Ansible as your source of truth, you can achieve unparalleled, centralized insight into all your NGINX deployments. All your deployment information lives within your Ansible playbooks, which are written in YAML, one of the most readable configuration languages.
- Our collections are certified and fully supported by Red Hat. If things go wrong, Red Hat’s award‑winning support can help you get back on track.
Our Ansible History
Before we talk about the new NGINX Core collection, let’s review our journey with Ansible.
2015:
- Published a blog describing how to create Ansible playbooks for installing NGINX and NGINX Plus. We were (rightly) told by a community member that our blog post would quickly become obsolete and we needed to develop and maintain an official Ansible role.
2017:
- Launched our two first Ansible roles which separately performed basic installation of NGINX and NGINX Plus.
2018:
- Unified the two initial roles into a single nginx role to install both NGINX and NGINX Plus.
- Enhanced the nginx role to configure NGINX, install NGINX Unit, and install NGINX Amplify.
2020:
- Released 16 new roles and a certified collection for NGINX Controller.
- Debuted the nginx_app_protect role to install and configure our new security solution, NGINX App Protect.
- Split the nginx role into three separate roles and released a second certified collection, NGINX Core.
The Evolution of the nginx Role
The nginx role is one of the most popular roles on Ansible Galaxy, with more than 700,000 downloads since we launched it in 2018. But in spite of its popularity, we got feedback that it was heavy and took too long to install. While some people love a Swiss Army knife™ that can do everything, there’s a lot to be gained with a scalpel approach (an approach that Ansible itself has followed with the introduction of collections). With that in mind, we decided to split up the nginx role into three separate roles to enable greater flexibility and speed:
- nginx – Installs NGINX and NGINX Plus
- nginx_config – Configures NGINX and NGINX Plus
- nginx_unit – Installs NGINX Unit
Introducing the NGINX Core Collection
In our continuous journey to improve our Ansible offerings, and following the introduction of collections in Ansible 2.10, we’ve created an NGINX collection that focuses on our “core” offering: software for fast and secure web serving, reverse proxy, and load balancing. As such, the NGINX Core collection includes three roles: the two roles for installing and configuring NGINX and NGINX Plus mentioned in the previous section (nginx and nginx_config), plus the nginx_app_protect role for installing and configuring NGINX App Protect, a fully featured WAF module for NGINX Plus.
Using the NGINX Core collection is as easy as using a role. To install it, run:
$ ansible-galaxy collection install nginxinc.nginx_core
You can then start using the collection’s roles in your playbooks by including the following lines at the beginning of your Ansible playbooks:
---
- collections:
- name: nginxinc.nginx_core
version: 0.1.3
The NGINX Core collection also comes with a series of playbooks that cover many use cases, ranging from a simple NGINX install to setting up a reverse proxy secured by NGINX App Protect in front of a couple of web servers. Alternatively, you can also check the playbooks included in each role’s molecule directory to find up-to-date working examples for each role.
Choosing Between the NGINX Core and NGINX Controller Collections
You might be wondering which of the two NGINX collections we offer is best for you. The answer, as is often the case, depends on your use case.
-
NGINX Core – Choose this collection if you:
- Are an NGINX Open Source user
- Are used to managing NGINX Plus directly
- Want to configure NGINX App Protect
- Don’t use NGINX Controller
- NGINX Controller – Choose this collection if you are an NGINX Controller subscriber.
Get Started with NGINX Roles and Collections
If you’re an Ansible Automation Platform subscriber, you can access certified NGINX collections on Ansible Automation Hub (in the nginxinc namespace). Alternatively, you can find the upstream, community versions of our roles and collections on Ansible Galaxy. We hope you’ll join us at virtual AnsibleFest this October 13–14 and attend Alessandro’s session on the NGINX Core collection. Plus you can visit our virtual booth to chat with the authors, get exclusive access to demos and webinars, and win some swag!
We see our collections as a starting place that will grow over time through efforts from NGINX and the community. Please contribute to the collection and let us know what new functionality is important to you.
If you want to take NGINX Plus and NGINX App Protect for a spin, request a free 30-day trial today or contact us to discuss your use cases.
With Red Hat and NGINX working together, you get the best from both our companies! Together we: