From d0548a7b0bbd2643b2c35e4d90c4580cf072eed1 Mon Sep 17 00:00:00 2001 From: Alessandro Fael Garcia Date: Fri, 28 Feb 2020 16:11:29 +0100 Subject: [PATCH] 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 --- CONTRIBUTING.md | 2 +- README.md | 65 ++----------------- defaults/main/controller.yml | 25 ------- handlers/main.yml | 5 -- meta/main.yml | 2 - tasks/controller/install-controller.yml | 15 ----- .../controller/setup-controller-instance.yml | 28 -------- .../setup-controller-repository.yml | 50 -------------- tasks/main.yml | 9 --- 9 files changed, 8 insertions(+), 193 deletions(-) delete mode 100644 defaults/main/controller.yml delete mode 100644 tasks/controller/install-controller.yml delete mode 100644 tasks/controller/setup-controller-instance.yml delete mode 100644 tasks/controller/setup-controller-repository.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed7cc1e..b71585a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ Follow our [Installation Guide](https://github.com/nginxinc/ansible-role-nginx/b ### 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 main code is found at `tasks/` * The main variables can be found at `defaults/main/` diff --git a/README.md b/README.md index 1e1f586..15a7fc6 100644 --- a/README.md +++ b/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) [![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. @@ -35,7 +35,7 @@ Use `git clone https://github.com/nginxinc/ansible-role-nginx.git` to pull the l 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** @@ -143,33 +143,6 @@ RedHat: - 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** ```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/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/upload.yml](./defaults/main/upload.yml):** NGINX configuration/HTML/SSL upload 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 ``` -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: - nginx_controller_endpoint: # 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. ```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`. +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 ------- diff --git a/defaults/main/controller.yml b/defaults/main/controller.yml deleted file mode 100644 index 0e75768..0000000 --- a/defaults/main/controller.yml +++ /dev/null @@ -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 diff --git a/handlers/main.yml b/handlers/main.yml index 7919dbd..4640f4d 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -22,11 +22,6 @@ name: amplify-agent 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" service: name: unit diff --git a/meta/main.yml b/meta/main.yml index 92aa6f9..0a3f86e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,5 @@ --- galaxy_info: - role_name: nginx author: Alessandro Fael Garcia description: Official Ansible role for NGINX company: NGINX, Inc. @@ -43,7 +42,6 @@ galaxy_info: - oss - plus - amplify - - controller - unit - web - server diff --git a/tasks/controller/install-controller.yml b/tasks/controller/install-controller.yml deleted file mode 100644 index 1ff172a..0000000 --- a/tasks/controller/install-controller.yml +++ /dev/null @@ -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 diff --git a/tasks/controller/setup-controller-instance.yml b/tasks/controller/setup-controller-instance.yml deleted file mode 100644 index 3156448..0000000 --- a/tasks/controller/setup-controller-instance.yml +++ /dev/null @@ -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 }}" diff --git a/tasks/controller/setup-controller-repository.yml b/tasks/controller/setup-controller-repository.yml deleted file mode 100644 index 1cc5bd9..0000000 --- a/tasks/controller/setup-controller-repository.yml +++ /dev/null @@ -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" diff --git a/tasks/main.yml b/tasks/main.yml index e30bafd..ead4e9b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,7 +7,6 @@ - ansible_os_family == "Debian" - nginx_install_from == "nginx_repository" or nginx_amplify_enable - or nginx_controller_enable or nginx_unit_enable tags: nginx_aptkey @@ -17,7 +16,6 @@ or ansible_os_family == "Suse" - nginx_install_from == "nginx_repository" or nginx_amplify_enable - or nginx_controller_enable or nginx_unit_enable tags: nginx_rpmkey @@ -82,13 +80,6 @@ - nginx_amplify_api_key | length > 0 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 when: nginx_unit_enable | bool tags: nginx_install_unit