forked from jessegoodier/NGINX-101-Workshop-UDF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx_controller_agent_3x.yaml
45 lines (39 loc) · 1.26 KB
/
nginx_controller_agent_3x.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- hosts: localhost
gather_facts: yes
vars:
controller:
user_email: "{{ user_email }}"
user_password: "{{ user_password }}"
fqdn: "{{ controller_fqdn }}"
validate_certs: false
tasks:
- name: Upgrade your packages
apt:
update_cache: yes
upgrade: yes
- name: Install minimal support for python2 for the NGINX Controller agent install script
apt:
name: "{{ item }}"
state: present
loop:
- python-minimal
- libxerces-c3.2
- name: Retrieve the NGINX Controller auth token
include_role:
name: nginxinc.nginx_controller_generate_token
- name: Get NGINX Controller API key for agent registration
uri:
url: "https://{{ controller.fqdn }}/api/v1/platform/global"
method: "GET"
return_content: yes
status_code: 200
validate_certs: "{{ controller.validate_certs | default(false) }}"
headers:
Cookie: "{{ controller.auth_token }}"
register: ctrl_globals
- name: Copy api_key to a variable
set_fact:
api_key: "{{ ctrl_globals.json.currentStatus.agentSettings.apiKey }}"
- name: Install the NGINX Controller agent
include_role:
name: nginxinc.nginx_controller_agent