forked from brianehlert/ansible-nginx-controller-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx_controller_agent_install.yaml
47 lines (41 loc) · 1.2 KB
/
nginx_controller_agent_install.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
46
47
---
- hosts: localhost
gather_facts: false
connection: local
tasks:
- include_role:
name: nginxinc.nginx_controller.nginx_controller_generate_token
- name: Get controller api key for agent registration
uri:
url: "https://{{nginx_controller_fqdn}}/api/v1/platform/global"
method: "GET"
return_content: yes
status_code: 200
validate_certs: false
headers:
Cookie: "{{nginx_controller_auth_token}}"
register: nginx_controller_globals
- name: Copy api_key to a variable
set_fact:
nginx_controller_api_key: "{{nginx_controller_globals.json.currentStatus.agentSettings.apiKey}}"
- hosts: tag_new_gateway
remote_user: ubuntu
become: true
become_method: sudo
gather_facts: yes
tasks:
- name: install minimal support for python2 for Agent install script
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- python-minimal
- libxerces-c3.2
- name: install the agent
include_role:
name: nginxinc.nginx_controller.nginx_controller_agent
vars:
nginx_controller_hostname: "{{ ansible_facts['fqdn'] }}"
# instance_name: "{{ ansible_facts['fqdn'] }}"
# location: