• Stars
    star
    633
  • Rank 71,037 (Top 2 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ansible role for installing NGINX

Ansible Galaxy Molecule CI/CD License Project Status: Active – The project has reached a stable, usable state and is being actively developed. Community Support

πŸ‘Ύ Help make the NGINX Ansible role better by participating in our survey! πŸ‘Ύ

Ansible NGINX Role

This role installs NGINX Open Source, NGINX Plus, or the NGINX Amplify agent on your target host.

Note: This role is still in active development. There may be unidentified issues and the role variables may change as development continues.

Requirements

NGINX Plus (Optional)

If you wish to install NGINX Plus using this role, 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.

Ansible

  • This role is developed and tested with maintained versions of Ansible core (above 2.12).

  • When using Ansible core, you will also need to install the following collections:

    ---
    collections:
      - name: ansible.posix
        version: 1.5.4
      - name: community.general
        version: 6.4.0
      - name: community.crypto # Only required if you plan to install NGINX Plus
        version: 2.14.1
      - name: community.docker # Only required if you plan to use Molecule (see below)
        version: 3.4.7

    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.

  • You will need to run this role as a root user using Ansible's become parameter. Make sure you have set up the appropriate permissions on your target hosts.

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

Jinja2

  • This role uses Jinja2 templates. Ansible core installs Jinja2 by default, but depending on your install and/or upgrade path, you might be running an outdated version of Jinja2. The minimum version of Jinja2 required for the role to properly function is 3.1.
  • Instructions on how to install Jinja2 can be found in the Jinja2 website.

Molecule (Optional)

  • Molecule is used to test the various functionalities of the role. The recommended version of Molecule to test this role is 4.x.

  • Instructions on how to install Molecule can be found in the Molecule website. You will also need to install the Molecule Docker driver.

  • To run the NGINX Plus Molecule tests, you must copy your NGINX Plus license to the role's files/license folder.

    You can alternatively add your NGINX Plus repository 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 -s plus

Installation

Ansible Galaxy

To install the latest stable release of the role on your system, use:

ansible-galaxy install nginxinc.nginx

Alternatively, if you have already installed the role, update the role to the latest release:

ansible-galaxy install -f nginxinc.nginx

Git

To pull the latest edge commit of the role from GitHub, use:

git clone https://github.com/nginxinc/ansible-role-nginx.git

Platforms

The NGINX Ansible role supports all platforms supported by NGINX Open Source, NGINX Plus, and the NGINX Amplify agent:

NGINX Open Source

AlmaLinux:
  - 8
  - 9
Alpine:
  - 3.15
  - 3.16
  - 3.17
  - 3.18
Amazon Linux:
  - 2
CentOS:
  - 7.4+
Debian:
  - bullseye (11)
  - bookworm (12)
Oracle Linux:
  - 7
  - 8
  - 9
Red Hat:
  - 7.4+
  - 8
  - 9
Rocky Linux:
  - 8
  - 9
SUSE/SLES:
  - 12
  - 15
Ubuntu:
  - focal (20.04)
  - jammy (22.04)
  - kinetic (22.10)
  - lunar (23.04)

NGINX Plus

AlmaLinux:
  - 8
  - 9
Alpine:
  - 3.15
  - 3.16
  - 3.17
  - 3.18
Amazon Linux:
  - 2
CentOS:
  - 7.4+
Debian:
  - bullseye (11)
  - bookworm (12)
FreeBSD:
  - 12.1+
  - 13
Oracle Linux:
  - 7.4+
  - 8.1+
  - 9
Red Hat:
  - 7.4+
  - 8.1+
  - 9
Rocky Linux:
  - 8
  - 9
SUSE/SLES:
  - 12
  - 15
Ubuntu:
  - focal (20.04)
  - jammy (22.04)

NGINX Amplify Agent

Amazon Linux:
  - 2
Debian:
  - buster (10)
  - bullseye (11)
Red Hat:
  - 8
  - 9
Ubuntu:
  - bionic (18.04)
  - focal (20.04)
  - jammy (22.04)

Note: You can also use this role to compile NGINX Open Source from source, install NGINX Open Source on compatible yet unsupported platforms, or install NGINX Open Source on BSD systems at your own risk.

Role Variables

This role has multiple variables. The descriptions and defaults for all these variables can be found in the defaults/main/ folder in the following files:

Name Description
main.yml NGINX installation variables
amplify.yml NGINX Amplify agent installation variables
bsd.yml BSD installation variables
logrotate.yml Logrotate configuration variables
selinux.yml SELinux configuration variables
systemd.yml Systemd configuration variables

Similarly, descriptions and defaults for preset variables can be found in the vars/ folder in the following files:

Name Description
main.yml List of supported NGINX platforms, modules, and Linux installation variables

Example Playbooks

Working functional playbook examples can be found in the molecule/ folder in the following files:

Name Description
default/converge.yml Install a specific version of NGINX, install various NGINX supported modules, tweak systemd and set up logrotate
distribution/converge.yml Install NGINX from the distribution's package repository instead of NGINX's package repository
downgrade/converge.yml Downgrade to a specific version of NGINX
downgrade-plus/converge.yml Downgrade to a specific version of NGINX Plus
plus/converge.yml Install NGINX Plus and various NGINX Plus supported modules
source/converge.yml Install NGINX from source
stable/converge.yml Install NGINX using the latest stable release
uninstall/converge.yml Uninstall NGINX
uninstall-plus/converge.yml Uninstall NGINX Plus
upgrade/converge.yml Upgrade NGINX
upgrade-plus/converge.yml Upgrade NGINX Plus
version/converge.yml Install a specific version of NGINX and various NGINX modules

Do note that if you install this repository via Ansible Galaxy, you will have to replace the role variable in the sample playbooks from ansible-role-nginx to nginxinc.nginx.

Other NGINX Ansible Collections and Roles

You can find the Ansible NGINX Core collection of roles to install and configure NGINX Open Source, NGINX Plus, and NGINX App Protect here.

You can find the Ansible NGINX configuration role to configure NGINX here.

You can find the Ansible NGINX App Protect role to install and configure NGINX App Protect WAF and NGINX App Protect DoS here.

You can find the Ansible NGINX Unit role to install NGINX Unit here.

License

Apache License, Version 2.0

Author Information

Alessandro Fael Garcia

Grzegorz Dzien

Tom Gamull

Β© F5, Inc. 2018 - 2023

More Repositories

1

kubernetes-ingress

NGINX and NGINX Plus Ingress Controllers for Kubernetes
Go
4,651
star
2

docker-nginx

Official NGINX Dockerfiles
Shell
3,236
star
3

nginx-prometheus-exporter

NGINX Prometheus Exporter for NGINX and NGINX Plus
Go
1,572
star
4

NGINX-Demos

NGINX and NGINX Plus demos
HTML
1,254
star
5

ngx-rust

Rust binding for NGINX
Rust
720
star
6

nginx-ldap-auth

Example of LDAP authentication using ngx_http_auth_request_module
Python
681
star
7

kic-reference-architectures

MARA: Modern Application Reference Architecture
Python
633
star
8

crossplane

Quick and reliable way to convert NGINX configurations into JSON and back.
Python
620
star
9

nginmesh

Istio compatible service mesh using NGINX
Go
611
star
10

nginx-s3-gateway

NGINX S3 Caching Gateway
JavaScript
511
star
11

nginx-gateway-fabric

NGINX Gateway Fabric provides an implementation for the Gateway API using NGINX as the data plane.
Go
488
star
12

docker-nginx-unprivileged

Unprivileged NGINX Dockerfiles
Shell
376
star
13

nginx-wiki

ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com
HTML
291
star
14

docker-nginx-amplify

Official NGINX and Amplify Dockerfiles
Shell
230
star
15

nginx-amplify-doc

Public documentation for Amplify
Makefile
201
star
16

nginx-openid-connect

Reference implementation of OpenID Connect integration for NGINX Plus
JavaScript
188
star
17

nginx-otel

Perl
157
star
18

ansible-role-nginx-config

Ansible role for configuring NGINX
Jinja
154
star
19

mra-ingenious

A photo-sharing app built by NGINX and implemented using the Fabric Model from the Microservices Reference Architecture.
JavaScript
143
star
20

rtapi

Real time API latency analyzer - Create a PDF report and HDR histogram of your APIs
Go
133
star
21

nginx-service-mesh

A service mesh powered by NGINX Plus to manage container traffic in Kubernetes environments.
Go
93
star
22

ansible-collection-nginx

Ansible collection for NGINX
67
star
23

nginx-ingress-operator

WARNING - DEPRECATION NOTICE: The NGINX Ingress Operator has been updated to be a Helm based operator. This repo has been deprecated and will soon be archived - the new NGINX Ingress Operator repo can be found at https://github.com/nginxinc/nginx-ingress-helm-operator.
Go
66
star
24

nginx-loadbalancer-kubernetes

A Kubernetes Controller to synchronize NGINX+ Resources with Kubernetes Ingress Resources
Go
58
star
25

nginx-asg-sync

NGINX Plus Integration with Cloud Autoscaling
Go
56
star
26

nginx-go-crossplane

A library for working with NGINX configs in Go
Go
55
star
27

bank-of-sirius

Bank of Sirius
Java
53
star
28

helm-charts

NGINX Helm Charts repository
50
star
29

nginx-plus-go-client

A client for NGINX Plus API for Go
Go
49
star
30

nginx-openshift-router

NGINX and NGINX Plus OpenShift Routers
HTML
42
star
31

nginx-ingress-helm-operator

NGINX Ingress Operator for NGINX and NGINX Plus Ingress Controllers. Based on the Helm chart for NGINX Ingress Controller - https://github.com/nginxinc/helm-charts
Mustache
37
star
32

docker-nginx-controller

Docker support for NGINX Controller Agent in Containers
Dockerfile
29
star
33

nginx-ingress-workshops

Nginx Ingress Controller Hands on Workshops, with Lab Exercises and Guides
Shell
29
star
34

microservices-march

Examples from the Microservices March lectures and exercises.
27
star
35

ngx-istio-mixer

NGINX module for Istio mixer
Rust
24
star
36

nginx-saml

Perl
23
star
37

new-relic-agent

A new relic agent for NGINX Plus metrics
Python
23
star
38

ansible-role-nginx-app-protect

Ansible role to install and configure NGINX App Protect (WAF and DoS) for NGINX Plus on your target host
Jinja
21
star
39

router-mesh-architecture

NGINX Router Mesh Network Architecture for Microservices
CSS
19
star
40

aws-ha-elastic-ip

Active-Passive HA Deployment on AWS Using an Elastic IP Address
Shell
17
star
41

nginx-plus-dashboard

HTML
16
star
42

website-resources-conf

content for nginx.com/resources/conf/ -- configuration files shared in blog posts, etc.
16
star
43

fabric-model-architecture

Repository for the NGINX Fabric Model Architecture
CSS
15
star
44

nginx-management-suite-iac

NMS IAC repo
HCL
14
star
45

ngxinfo

Python
13
star
46

Community-Code-of-Conduct

NGINX Open Source Community's Code of Conduct
11
star
47

nginx-amplify-agent

NGINX Amplify Agent
Python
11
star
48

mra-user-manager

User manager
HTML
10
star
49

snarejs

Snare.js
JavaScript
10
star
50

nginx-ns1-gslb

ARCHIVED - NGINX Plus Integration with NS1 GSLB
Go
10
star
51

mra-auth-proxy

Auth proxy for MRA
Jinja
9
star
52

nginx-wrapper

NGINX Event Process Wrapper
Go
9
star
53

template-repository

A template repository for new NGINX projects
9
star
54

ngx-stream-nginmesh-dest

Nginx module to get dest ip and port
C
8
star
55

ansible-role-nginx-unit

Ansible role for NGINX Unit
Jinja
8
star
56

ebook-managing-kubernetes-nginx

Shell
8
star
57

nginx-basics-workshops

HTML
8
star
58

nginx-unsupported-modules

Container builds of unsupported NGINX modules
Shell
7
star
59

nginx-hugo-theme

A hugo theme for NGINX documentation
CSS
7
star
60

ansible-role-nginx-management-suite

Ansible role for the NGINX Management Suite
Jinja
7
star
61

mra-content-service

Go
6
star
62

nginx-for-azure-deploy-action

Github Actions to sync NGINX configs into the NGINX for Azure service.
TypeScript
6
star
63

mra-photouploader

HTML
5
star
64

ansible_collection_nginx_controller

Collection of NGINX Controller Roles for Ansible
5
star
65

mra-photoresizer

HTML
5
star
66

nginx-controller-lab

Shell
4
star
67

mra-pages

JavaScript
4
star
68

nginxaas-for-azure-snippets

Example ARM templates for common NGINX for Azure use cases
Python
4
star
69

.github

4
star
70

nginx-plus-install-tools

NGINX Plus Install tools
Shell
4
star
71

mra-album-manager

Ruby
4
star
72

nginx-azure-workshops

Instructor Lead and Hands-on Lab Exercises and Lab Guides for NGINX as a Service for Microsoft Azure
Shell
4
star
73

homebrew-tap

Ruby
3
star
74

ansible-role-nginx_controller_application

Jinja
3
star
75

ansible_role_nginx_controller_agent

Ansible role for installing the NGINX Controller agent
Jinja
3
star
76

nap-dos-arbitrator-helm-chart

Smarty
3
star
77

nginx-aws-signature

NGINX AWS Signature Library to authenticate AWS services such as S3 and Lambda via NGINX and NGINX Plus.
JavaScript
3
star
78

alpine-fips

Alpine Linux with FIPS OpenSSL module
Dockerfile
3
star
79

ansible-role-nginx_controller_publish_api

Jinja
2
star
80

kic-test-containers

Docker containers used by the KIC team
Go
2
star
81

ansible-role-nginx_controller_user

Jinja
2
star
82

ansible-role-nginx_controller_environment

Managing environments within NGINX Controller
Jinja
2
star
83

ansible-role-nginx_controller_api_definition_import

Jinja
2
star
84

ansible-role-nginx-controller-gateway

Jinja
2
star
85

ansible_role_nginx_controller_install

Ansible role for installing NGINX Controller
Jinja
2
star
86

ansible-role-nginx-controller-certificate

Jinja
2
star
87

ansible-role-nginx-controller-component

Jinja
2
star
88

ansible_role_nginx_controller_generate_token

Jinja
2
star
89

ansible-role-nginx_controller_location

Jinja
2
star
90

ansible-role-nginx-controller-license

Jinja
2
star
91

ansible-role-nginx_controller_integration

Jinja
2
star
92

aws-marketplace-publish

Publish Docker images to AWS Marketplace
TypeScript
2
star
93

ansible-role-nginx_controller_user_role

Jinja
1
star
94

ansible-role-nginx_controller_forwarder

Jinja
1
star