-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadd_controller_agent.yaml
62 lines (52 loc) · 1.67 KB
/
add_controller_agent.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
# this is a playbook to install agent on new instances in AWS.
# the inventory group is generated by Tower based on an absent tag which is populated at the end of this playbook.
#
- name: query for NGINX Controller information
hosts: localhost
gather_facts: false
connection: local
tasks:
- include_role:
name: ansible-role-nginx-controller-generate-token
- name: Get 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: 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 nginx controller agent
hosts: noagent
gather_facts: true
vars:
controller_hostname: "{{ inventory_hostname }}"
tasks:
- debug:
- msg: upgrade software on {{inventory_hostname}}
- msg: current host is {{ansible_hostname}}
- msg: controller_hostname is {{controller_hostname}}
# - 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 NGINX Controller agent on new instances
# include_role:
# name: ansible-role-nginx-controller-agent
# vars:
# controller_hostname: "{{hostname}}"
# loop:
# controller_hostname
# loop_control:
# loop_var: hostname
# - name: set the contorller_hostname tag