NGINX.COM

Editor – The separate Ansible roles for NGINX Open Source and NGINX Plus described in this post are deprecated by a unified Ansible role from NGINX, as announced in this blog post. The separate roles described here are no longer being maintained or updated.

For information about other DevOps automation tools for NGINX and NGINX Plus, check out these blog posts:

NGINX, Inc. has created Ansible roles for NGINX Open Source and NGINX Plus, available on Ansible Galaxy.

A playbook is the Ansible automation engine for application deployment, enabling users to install and configure applications across multiple servers, environments, and operating systems, all from one central location. An Ansible role, in turn, bundles Ansible variables, tasks, and handlers into a clearly defined file structure. An Ansible role can be dropped into an Ansible playbook and immediately put to work.

You can find community‑developed roles at Ansible Galaxy, a free site for sharing, finding, and downloading roles. Downloading roles from Ansible Galaxy is a great way to jump‑start your automation projects.

Installing the NGINX roles from Ansible Galaxy is very simple. To install the NGINX Open Source role [Editor – now deprecated], run:

$ ansible-galaxy install nginxinc.nginx-oss

To install the NGINX Plus role [Editor – also now deprecated], run:

$ ansible-galaxy install nginxinc.nginx-plus

You can now deploy NGINX Open Source within a cloud provider with a simple Ansible playbook:

---
- hosts: localhost
  remote_user: root
  become: true
  roles:
    - role: ansible-nginx-oss     # Note: deprecated by ansible-role-nginx

You can also easily deploy NGINX Open Source to a dynamic inventory containing the NGINX tag:

--
- hosts: tag_nginx
  remote_user: root
  become: true
  roles:
    - role: ansible-nginx-oss     # Note: deprecated by ansible-role-nginx

Deploying NGINX Plus within a cloud provider additionally requires you to define the location of the certificate and key you received with your NGINX Plus license:

---
- hosts: localhost
  remote_user: root
  become: true
  roles:
    - role: ansible-nginx-plus    # Note: deprecated by ansible-role-nginx
  vars:
    - certs: ~/certs/

Similarly, specify the location of your NGINX Plus certificate and key when deploying NGINX Plus within a dynamic inventory containing the NGINX tag:

---
- hosts: tag_nginx
  remote_user: root
  become: true
  roles:
    - role: ansible-nginx-plus    # Note: deprecated by ansible-role-nginx
  vars:
    - certs: ~/certs/

For more details, visit the Ansible Galaxy page.

Hero image
免费白皮书:
NGINX 企阅版全解析

助力企业用户规避开源治理风险,应对开源使用挑战

关于作者

Alessandro Fael Garcia

Technical Marketing Engineer

关于 F5 NGINX

F5, Inc. 是备受欢迎的开源软件 NGINX 背后的商业公司。我们为现代应用的开发和交付提供一整套技术。我们的联合解决方案弥合了 NetOps 和 DevOps 之间的横沟,提供从代码到用户的多云应用服务。访问 nginx-cn.net 了解更多相关信息。