The Ansible NGINX collection includes a variety of NGINX Ansible roles to help automate the installation and configuration of NGINX. This collection is maintained by NGINX.
Note: This collection is still in active development. There may be unidentified issues as development continues.
The current stable release (0.8.0
) of the Ansible NGINX collection includes the following roles:
Name | Description | Version |
---|---|---|
nginxinc.nginx | Install NGINX | 0.24.0 |
nginxinc.nginx_config | Configure NGINX | 0.6.0 |
nginxinc.nginx_app_protect | Install and configure NGINX App Protect | 0.9.0 |
If you wish to install NGINX Plus using this collection, you will need to obtain an NGINX Plus license beforehand. You do not need to do anything beforehand if you want to install NGINX OSS.
If you wish to install NGINX App Protect WAF or NGINX App Protect DoS using this collection, you will need to obtain the corresponding NGINX App Protect license beforehand.
2.12
).When using Ansible core, you will also need to install the following collections:
---
collections:
- name: ansible.posix
version: 1.4.0
- name: community.crypto
version: 2.10.0
- name: community.general
version: 6.2.0
- name: community.docker # Only required if you plan to use Molecule (see below)
version: 3.4.0
Note: You can alternatively install the Ansible community distribution (what is known as the "old" Ansible) if you don't want to manage individual collections.
become
parameter. Make sure you have set up the appropriate permissions on your target hosts.3.1
.4.x
.To run the NGINX Plus and/or NGINX App Protect Molecule tests, you must copy your corresponding license to the respective role's files/license
folder.
You can alternatively add your NGINX certificate and key to the local environment. Run the following commands to export these files as base64-encoded variables and execute the Molecule tests:
export NGINX_CRT=$( cat <path to your certificate file> | base64 )
export NGINX_KEY=$( cat <path to your key file> | base64 )
molecule test --all
To install the latest stable release of the collection on your system, use:
ansible-galaxy collection install nginxinc.nginx_core
Alternatively, if you have already installed the collection, update the collection to the latest release:
ansible-galaxy collection install -f nginxinc.nginx_core
You can also include the collection in a requirements.yml
file:
---
collections:
- name: nginxinc.nginx_core
version: 0.8.0
And install the collection:
ansible-galaxy collection install -r requirements.yml
To pull the latest edge commit of the role from GitHub, use:
git clone https://github.com/nginxinc/ansible-collection-nginx.git
Sample playbooks for each use case covered by this collection can be found in the playbooks/
folder in the following files:
Name | Description |
---|---|
deploy-nginx.yml |
Install NGINX |
deploy-nginx-web-server.yml |
Install NGINX and configure a simple web server |
deploy-nginx-web-server-proxy.yml |
Install NGINX and configure a simple reverse proxy in front of two web servers |
deploy-nginx-plus.yml |
Install NGINX Plus |
deploy-nginx-app-protect.yml |
Install NGINX App Protect WAF/DoS |
deploy-nginx-plus-app-protect.yml |
Install NGINX Plus and NGINX App Protect WAF |
deploy-nginx-plus-app-protect-web-server-proxy.yml |
Install NGINX Plus and NGINX App Protect and configure a simple reverse proxy in front of two web servers protected by NGINX App Protect WAF/DoS |
Currently, all the NGINX roles included in this collection (found in the roles/
folder) are Git submodules, and work on the roles themselves should take place in the corresponding upstream role repository.
To update the roles included in this collection to their latest version, use:
git submodule update --recursive --remote
You can find the Ansible NGINX Unit role to install NGINX Unit here.
© F5, Inc. 2020 - 2023