Install NGINX Controller agent
This commit is contained in:
parent
a8db981f60
commit
ef1294b91c
@ -49,6 +49,13 @@ modules:
|
|||||||
amplify_enable: false
|
amplify_enable: false
|
||||||
amplify_key: null
|
amplify_key: null
|
||||||
|
|
||||||
|
# Install NGINX Controller.
|
||||||
|
# Use your NGINX Controller API key.
|
||||||
|
# Default is null.
|
||||||
|
controller_enable: false
|
||||||
|
controller_license: null
|
||||||
|
controller_api_url: null
|
||||||
|
|
||||||
# Enable NGINX status data.
|
# Enable NGINX status data.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
|
@ -21,3 +21,8 @@
|
|||||||
name: unitd
|
name: unitd
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
|
- name: "(Handler: All OSs) Start NGINX Controller Agent"
|
||||||
|
service:
|
||||||
|
name: controller-agent
|
||||||
|
state: started
|
||||||
|
@ -35,6 +35,7 @@ galaxy_info:
|
|||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- nginx
|
- nginx
|
||||||
- amplify
|
- amplify
|
||||||
|
- controller
|
||||||
- oss
|
- oss
|
||||||
- plus
|
- plus
|
||||||
- web
|
- web
|
||||||
|
42
tasks/controller/install-controller.yml
Normal file
42
tasks/controller/install-controller.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: setup-debian.yml
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- import_tasks: setup-redhat.yml
|
||||||
|
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 = {{ controller_license }}"
|
||||||
|
|
||||||
|
- name: "(Setup: All OSs) Configure NGINX Controller Agent API URL"
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/controller-agent/agent.conf
|
||||||
|
regexp: api_url =.*
|
||||||
|
line: "api_url = {{ controller_api_url }}"
|
||||||
|
|
||||||
|
- 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"
|
5
tasks/controller/setup-debian.yml
Normal file
5
tasks/controller/setup-debian.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: "(Install: Debian/Ubuntu) Add NGINX Controller Repository"
|
||||||
|
apt_repository:
|
||||||
|
filename: nginx-controller
|
||||||
|
repo: deb http://packages.nginx.org/controller/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release|lower }} controller
|
7
tasks/controller/setup-redhat.yml
Normal file
7
tasks/controller/setup-redhat.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: "(Install: CentOS/RedHat) Add NGINX Controller Agent Repository"
|
||||||
|
yum_repository:
|
||||||
|
name: nginx-controller
|
||||||
|
baseurl: http://packages.nginx.org/controller/centos/$releasever/$basearch/
|
||||||
|
description: NGINX Controller Agent
|
||||||
|
gpgcheck: yes
|
@ -31,10 +31,13 @@
|
|||||||
- import_tasks: conf/setup-rest-api.yml
|
- import_tasks: conf/setup-rest-api.yml
|
||||||
when: rest_api_enable and type == "plus"
|
when: rest_api_enable and type == "plus"
|
||||||
|
|
||||||
|
when: nginx_enable
|
||||||
|
|
||||||
- import_tasks: amplify/install-amplify.yml
|
- import_tasks: amplify/install-amplify.yml
|
||||||
when: amplify_enable and amplify_key is defined and amplify_key
|
when: amplify_enable and amplify_key is defined and amplify_key
|
||||||
|
|
||||||
when: nginx_enable
|
- import_tasks: controller/install-controller.yml
|
||||||
|
when: controller_enable and controller_license is defined and controller_license and controller_api_url is defined and controller_api_url
|
||||||
|
|
||||||
- import_tasks: unit/install-unit.yml
|
- import_tasks: unit/install-unit.yml
|
||||||
when: unit_enable
|
when: unit_enable
|
||||||
|
Loading…
Reference in New Issue
Block a user