Remove NGINX Controller agent tasks (#228)
There's now a separate collection of NGINX Controller roles that can be found at https://github.com/nginxinc/ansible-collection-nginx_controller making the task in this role obsolete
This commit is contained in:
parent
5ac87644a8
commit
d0548a7b0b
@ -26,7 +26,7 @@ Follow our [Installation Guide](https://github.com/nginxinc/ansible-role-nginx/b
|
|||||||
|
|
||||||
### Project Structure
|
### Project Structure
|
||||||
|
|
||||||
* The NGINX Ansible role is written in `yaml` and supports open source NGINX, NGINX Plus, NGINX Amplify, NGINX Controller, and NGINX Unit.
|
* The NGINX Ansible role is written in `yaml` and supports open source NGINX, NGINX Plus, NGINX Amplify, and NGINX Unit.
|
||||||
* The project follows the standard [Ansible role directory structure](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html)
|
* The project follows the standard [Ansible role directory structure](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html)
|
||||||
* The main code is found at `tasks/`
|
* The main code is found at `tasks/`
|
||||||
* The main variables can be found at `defaults/main/`
|
* The main variables can be found at `defaults/main/`
|
||||||
|
65
README.md
65
README.md
@ -4,7 +4,7 @@ Ansible NGINX Role
|
|||||||
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-nginxinc.nginx-5bbdbf.svg)](https://galaxy.ansible.com/nginxinc/nginx)
|
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-nginxinc.nginx-5bbdbf.svg)](https://galaxy.ansible.com/nginxinc/nginx)
|
||||||
[![Build Status](https://travis-ci.org/nginxinc/ansible-role-nginx.svg?branch=master)](https://travis-ci.org/nginxinc/ansible-role-nginx)
|
[![Build Status](https://travis-ci.org/nginxinc/ansible-role-nginx.svg?branch=master)](https://travis-ci.org/nginxinc/ansible-role-nginx)
|
||||||
|
|
||||||
This role installs NGINX Open Source, NGINX Plus, the NGINX Amplify agent, the NGINX Controller agent, or NGINX Unit on your target host.
|
This role installs NGINX Open Source, NGINX Plus, the NGINX Amplify agent, or NGINX Unit 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.
|
**Note:** This role is still in active development. There may be unidentified issues and the role variables may change as development continues.
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ Use `git clone https://github.com/nginxinc/ansible-role-nginx.git` to pull the l
|
|||||||
Platforms
|
Platforms
|
||||||
---------
|
---------
|
||||||
|
|
||||||
The NGINX Ansible role supports all platforms supported by [NGINX Open Source](https://nginx.org/en/linux_packages.html#mainline), [NGINX Plus](https://www.nginx.com/products/technical-specs/), the [NGINX Amplify agent](https://github.com/nginxinc/nginx-amplify-doc/blob/master/amplify-faq.md#21-what-operating-systems-are-supported), the [NGINX Controller agent](https://docs.nginx.com/nginx-controller/technical-specs/#nginx-controller-agent-technical-specifications), and [NGINX Unit](https://unit.nginx.org/installation/#official-packages):
|
The NGINX Ansible role supports all platforms supported by [NGINX Open Source](https://nginx.org/en/linux_packages.html#mainline), [NGINX Plus](https://www.nginx.com/products/technical-specs/), the [NGINX Amplify agent](https://github.com/nginxinc/nginx-amplify-doc/blob/master/amplify-faq.md#21-what-operating-systems-are-supported), and [NGINX Unit](https://unit.nginx.org/installation/#official-packages):
|
||||||
|
|
||||||
**NGINX Open Source**
|
**NGINX Open Source**
|
||||||
|
|
||||||
@ -143,33 +143,6 @@ RedHat:
|
|||||||
- 7
|
- 7
|
||||||
```
|
```
|
||||||
|
|
||||||
**NGINX Controller Agent**
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Amazon Linux:
|
|
||||||
versions:
|
|
||||||
- 2017.09
|
|
||||||
Amazon Linux 2:
|
|
||||||
versions:
|
|
||||||
- LTS
|
|
||||||
CentOS:
|
|
||||||
versions:
|
|
||||||
- 6
|
|
||||||
- 7
|
|
||||||
Debian:
|
|
||||||
versions:
|
|
||||||
- jessie
|
|
||||||
- stretch
|
|
||||||
Ubuntu:
|
|
||||||
versions:
|
|
||||||
- xenial
|
|
||||||
- bionic
|
|
||||||
RedHat:
|
|
||||||
versions:
|
|
||||||
- 6
|
|
||||||
- 7
|
|
||||||
```
|
|
||||||
|
|
||||||
**NGINX Unit**
|
**NGINX Unit**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -209,7 +182,6 @@ This role has multiple variables. The descriptions and defaults for all these va
|
|||||||
|
|
||||||
- **[defaults/main/main.yml](./defaults/main/main.yml):** NGINX installation variables
|
- **[defaults/main/main.yml](./defaults/main/main.yml):** NGINX installation variables
|
||||||
- **[defaults/main/amplify.yml](./defaults/main/amplify.yml):** NGINX Amplify agent installation variables
|
- **[defaults/main/amplify.yml](./defaults/main/amplify.yml):** NGINX Amplify agent installation variables
|
||||||
- **[defaults/main/controller.yml](./defaults/main/controller.yml):** NGINX Controller agent installation variables
|
|
||||||
- **[defaults/main/template.yml](./defaults/main/template.yml):** NGINX configuration templating variables
|
- **[defaults/main/template.yml](./defaults/main/template.yml):** NGINX configuration templating variables
|
||||||
- **[defaults/main/upload.yml](./defaults/main/upload.yml):** NGINX configuration/HTML/SSL upload variables
|
- **[defaults/main/upload.yml](./defaults/main/upload.yml):** NGINX configuration/HTML/SSL upload variables
|
||||||
- **[defaults/main/linux.yml](./defaults/main/linux.yml):** Linux installation variables
|
- **[defaults/main/linux.yml](./defaults/main/linux.yml):** Linux installation variables
|
||||||
@ -400,34 +372,6 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
|
|||||||
nginx_type: plus
|
nginx_type: plus
|
||||||
```
|
```
|
||||||
|
|
||||||
This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Plus and the NGINX Controller agent. Commented out
|
|
||||||
are sample variables to install the NGINX Controller agent from your NGINX Controller instance instead of the NGINX repository.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- hosts: localhost
|
|
||||||
become: true
|
|
||||||
roles:
|
|
||||||
- role: nginxinc.nginx
|
|
||||||
vars:
|
|
||||||
nginx_type: plus
|
|
||||||
nginx_rest_api_enable: true
|
|
||||||
nginx_rest_api_port: 80
|
|
||||||
nginx_rest_api_write: true
|
|
||||||
nginx_controller_enable: true
|
|
||||||
nginx_controller_source: repository
|
|
||||||
nginx_controller_api_key: <API_KEY_HERE>
|
|
||||||
nginx_controller_endpoint: <FQDN> # e.g. controller.nginx.com
|
|
||||||
# nginx_type: plus
|
|
||||||
# nginx_rest_api_enable: true
|
|
||||||
# nginx_rest_api_port: 80
|
|
||||||
# nginx_rest_api_write: true
|
|
||||||
# nginx_controller_enable: true
|
|
||||||
# nginx_controller_source: instance
|
|
||||||
# nginx_controller_endpoint: controller.nginx.com
|
|
||||||
# nginx_controller_user_email: john_doe@nginx.com
|
|
||||||
# nginx_controller_password: password
|
|
||||||
```
|
|
||||||
|
|
||||||
This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Unit and the PHP/Perl NGINX Unit language modules.
|
This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Unit and the PHP/Perl NGINX Unit language modules.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -448,6 +392,11 @@ To run any of the above sample playbooks create a `setup-nginx.yml` file and pas
|
|||||||
|
|
||||||
Alternatively, you can also clone this repository instead of installing it from Ansible Galaxy. If you decide to do so, replace the role variable in the previous sample playbooks from `nginxinc.nginx` to `ansible-role-nginx`.
|
Alternatively, you can also clone this repository instead of installing it from Ansible Galaxy. If you decide to do so, replace the role variable in the previous sample playbooks from `nginxinc.nginx` to `ansible-role-nginx`.
|
||||||
|
|
||||||
|
Other NGINX Roles
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
You can find an Ansible collection of roles to help you install and configure NGINX Controller [here](https://github.com/nginxinc/ansible-collection-nginx_controller)
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
# Install NGINX Controller Agent.
|
|
||||||
# Requires NGINX Plus and write access to the NGINX Plus REST API.
|
|
||||||
nginx_controller_enable: false
|
|
||||||
|
|
||||||
# Set the source from where to pull the NGINX Controller Agent.
|
|
||||||
# Options are 'instance', to pull the NGINX Controller Agent install script
|
|
||||||
# from your NGINX Controller instance, or 'repository', to pull the NGINX
|
|
||||||
# Controller Agent from the NGINX repository.
|
|
||||||
# Default is instance.
|
|
||||||
nginx_controller_source: instance
|
|
||||||
|
|
||||||
# Set your NGINX Controller Endpoint. Required for both types of NGINX Controller
|
|
||||||
# installation.
|
|
||||||
nginx_controller_endpoint: null
|
|
||||||
|
|
||||||
# Set your NGINX Controller API key.
|
|
||||||
# Required when 'nginx_controller_source' is set to 'repository'.
|
|
||||||
# Default is null.
|
|
||||||
nginx_controller_api_key: null
|
|
||||||
|
|
||||||
# Set your NGINX Controller Admin Email and Password.
|
|
||||||
# Required when 'nginx_controller_source' is set to 'instance'.
|
|
||||||
nginx_controller_user_email: null
|
|
||||||
nginx_controller_password: null
|
|
@ -22,11 +22,6 @@
|
|||||||
name: amplify-agent
|
name: amplify-agent
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: "(Handler: All OSs) Start NGINX Controller Agent"
|
|
||||||
service:
|
|
||||||
name: controller-agent
|
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||||
service:
|
service:
|
||||||
name: unit
|
name: unit
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
role_name: nginx
|
|
||||||
author: Alessandro Fael Garcia
|
author: Alessandro Fael Garcia
|
||||||
description: Official Ansible role for NGINX
|
description: Official Ansible role for NGINX
|
||||||
company: NGINX, Inc.
|
company: NGINX, Inc.
|
||||||
@ -43,7 +42,6 @@ galaxy_info:
|
|||||||
- oss
|
- oss
|
||||||
- plus
|
- plus
|
||||||
- amplify
|
- amplify
|
||||||
- controller
|
|
||||||
- unit
|
- unit
|
||||||
- web
|
- web
|
||||||
- server
|
- server
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
- import_tasks: setup-controller-instance.yml
|
|
||||||
when:
|
|
||||||
- nginx_controller_source == "instance"
|
|
||||||
- nginx_controller_user_email is defined
|
|
||||||
- nginx_controller_user_email | length > 0
|
|
||||||
- nginx_controller_password is defined
|
|
||||||
- nginx_controller_password | length > 0
|
|
||||||
|
|
||||||
|
|
||||||
- import_tasks: setup-controller-repository.yml
|
|
||||||
when:
|
|
||||||
- nginx_controller_source == "repository"
|
|
||||||
- nginx_controller_api_key is defined
|
|
||||||
- nginx_controller_api_key | length > 0
|
|
@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "(Install: All OSs) Fetch NGINX Controller API Key"
|
|
||||||
uri:
|
|
||||||
url: "https://{{ nginx_controller_endpoint }}/sapi/auth/login/"
|
|
||||||
method: "POST"
|
|
||||||
body:
|
|
||||||
email: "{{ nginx_controller_user_email }}"
|
|
||||||
password: "{{ nginx_controller_password }}"
|
|
||||||
body_format: json
|
|
||||||
return_content: yes
|
|
||||||
status_code: 200
|
|
||||||
validate_certs: false
|
|
||||||
register: controller_return
|
|
||||||
|
|
||||||
- name: "(Install: All OSs) Download the NGINX Controller Agent Installer Script"
|
|
||||||
get_url:
|
|
||||||
url: "https://{{ nginx_controller_endpoint }}:8443/1.4/install/controller/"
|
|
||||||
dest: /tmp/install.sh
|
|
||||||
validate_certs: no
|
|
||||||
force: yes
|
|
||||||
|
|
||||||
- name: "(Install: All OSs) Run the NGINX Controller Agent Installer Script"
|
|
||||||
command: "sh ./install.sh -y"
|
|
||||||
args:
|
|
||||||
chdir: /tmp
|
|
||||||
creates: /var/log/nginx-controller/agent.log
|
|
||||||
environment:
|
|
||||||
API_KEY: "{{ controller_return.json.api_key }}"
|
|
@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "(Install: Debian/Ubuntu) Add NGINX Controller Agent Repository"
|
|
||||||
apt_repository:
|
|
||||||
filename: nginx-controller
|
|
||||||
repo: deb [arch=amd64] https://packages.nginx.org/controller/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release | lower }} controller
|
|
||||||
when: ansible_os_family == "Debian"
|
|
||||||
|
|
||||||
- name: "(Install: CentOS/RedHat) Add NGINX Controller Agent Repository"
|
|
||||||
yum_repository:
|
|
||||||
name: nginx-controller
|
|
||||||
baseurl: https://packages.nginx.org/controller/centos/$releasever/$basearch/
|
|
||||||
description: NGINX Controller Agent
|
|
||||||
gpgcheck: yes
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Controller Agent"
|
|
||||||
package:
|
|
||||||
name: nginx-controller-agent
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Copy NGINX Controller Agent Configuration Template"
|
|
||||||
copy:
|
|
||||||
remote_src: yes
|
|
||||||
src: /etc/controller-agent/agent.controller.conf.default
|
|
||||||
dest: /etc/controller-agent/agent.conf
|
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Copy NGINX Configurator Agent Configuration Template"
|
|
||||||
copy:
|
|
||||||
remote_src: yes
|
|
||||||
src: /etc/controller-agent/agent.configurator.conf.default
|
|
||||||
dest: /etc/controller-agent/agent.configurator.conf
|
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Key"
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/controller-agent/agent.conf
|
|
||||||
regexp: api_key =.*
|
|
||||||
line: "api_key = {{ nginx_controller_api_key }}"
|
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Configure NGINX Controller Agent API URL"
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/controller-agent/agent.conf
|
|
||||||
regexp: api_url =.*
|
|
||||||
line: "api_url = https://{{ nginx_controller_endpoint }}/1.4"
|
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Hostname"
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/controller-agent/agent.conf
|
|
||||||
regexp: hostname =.*
|
|
||||||
line: "hostname = {{ ansible_hostname }}"
|
|
||||||
notify: "(Handler: All OSs) Start NGINX Controller Agent"
|
|
@ -7,7 +7,6 @@
|
|||||||
- ansible_os_family == "Debian"
|
- ansible_os_family == "Debian"
|
||||||
- nginx_install_from == "nginx_repository"
|
- nginx_install_from == "nginx_repository"
|
||||||
or nginx_amplify_enable
|
or nginx_amplify_enable
|
||||||
or nginx_controller_enable
|
|
||||||
or nginx_unit_enable
|
or nginx_unit_enable
|
||||||
tags: nginx_aptkey
|
tags: nginx_aptkey
|
||||||
|
|
||||||
@ -17,7 +16,6 @@
|
|||||||
or ansible_os_family == "Suse"
|
or ansible_os_family == "Suse"
|
||||||
- nginx_install_from == "nginx_repository"
|
- nginx_install_from == "nginx_repository"
|
||||||
or nginx_amplify_enable
|
or nginx_amplify_enable
|
||||||
or nginx_controller_enable
|
|
||||||
or nginx_unit_enable
|
or nginx_unit_enable
|
||||||
tags: nginx_rpmkey
|
tags: nginx_rpmkey
|
||||||
|
|
||||||
@ -82,13 +80,6 @@
|
|||||||
- nginx_amplify_api_key | length > 0
|
- nginx_amplify_api_key | length > 0
|
||||||
tags: nginx_install_amplify
|
tags: nginx_install_amplify
|
||||||
|
|
||||||
- import_tasks: controller/install-controller.yml
|
|
||||||
when:
|
|
||||||
- nginx_controller_enable | bool
|
|
||||||
- nginx_controller_endpoint is defined
|
|
||||||
- nginx_controller_endpoint | length > 0
|
|
||||||
tags: nginx_install_controller
|
|
||||||
|
|
||||||
- import_tasks: unit/install-unit.yml
|
- import_tasks: unit/install-unit.yml
|
||||||
when: nginx_unit_enable | bool
|
when: nginx_unit_enable | bool
|
||||||
tags: nginx_install_unit
|
tags: nginx_install_unit
|
||||||
|
Loading…
Reference in New Issue
Block a user