-
Notifications
You must be signed in to change notification settings - Fork 2
/
0_download_agents.yml
89 lines (77 loc) · 3.04 KB
/
0_download_agents.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
- name: Download appd agents
hosts: localhost
vars:
download_username: "{{ secret_download_username }}"
download_password: "{{ secret_download_password }}"
download_java_agent_uri: "{{ java_agent_uri }}"
download_machine_agent_uri: "{{ machine_agent_uri }}"
download_db_agent_uri: "{{ db_agent_uri }}"
download_tomcat_uri: "{{ tomcat_uri }}"
download_java_agent_file: "{{ download_java_agent_uri | basename }}"
download_machine_agent_file: "{{ download_machine_agent_uri | basename }}"
download_db_agent_file: "{{ download_db_agent_uri | basename }}"
download_tomcat_file: "{{ download_tomcat_uri | basename }}"
download_java_agent_path: "./roles/appd_java_agent/files/{{ download_java_agent_file}}"
download_machine_agent_path: "./roles/appd_machine_agent/files/{{ download_machine_agent_file}}"
download_db_agent_path: "./roles/appd_db_agent/files/{{ download_db_agent_file}}"
download_tomcat_path: "./roles/tomcat_server/files/{{ download_tomcat_file}}"
tasks:
- name: Login to appdynamics
uri:
url: https://identity.msrv.saas.appdynamics.com/v2.0/oauth/token
method: POST
body_format: json
body: '{"username": "{{ download_username }}","password": "{{ download_password }}","scopes": ["download"]}'
status_code: 200
register: login
- name: "Check if {{ download_machine_agent_path }} exists"
stat:
path: "{{ download_machine_agent_path }}"
register: stat_machine_agent
- name: Download machine agent
uri:
url: "{{ download_machine_agent_uri }}"
method: GET
headers:
Authorization: "Bearer {{ login.json.access_token }}"
dest: "{{ download_machine_agent_path }}"
status_code: 200
when: not stat_machine_agent.stat.exists
- name: "Check if {{ download_db_agent_path }} exists"
stat:
path: "{{ download_db_agent_path }}"
register: stat_db_agent
- name: Download db agent
uri:
url: "{{ download_db_agent_uri }}"
method: GET
headers:
Authorization: "Bearer {{ login.json.access_token }}"
dest: "{{ download_db_agent_path }}"
status_code: 200
when: not stat_db_agent.stat.exists
- name: "Check if {{ download_java_agent_path }} exists"
stat:
path: "{{ download_java_agent_path }}"
register: stat_java_agent
- name: "Check if {{ download_tomcat_path }} exists"
stat:
path: "{{ download_tomcat_path }}"
register: stat_tomcat
- name: Download java agent
uri:
url: "{{ download_java_agent_uri }}"
method: GET
headers:
Authorization: "Bearer {{ login.json.access_token }}"
dest: "{{ download_java_agent_path }}"
status_code: 200
when: not stat_java_agent.stat.exists
- name: Download tomcat server
uri:
url: "{{ download_tomcat_uri }}"
method: GET
dest: "{{ download_tomcat_path }}"
status_code: 200
when: not stat_tomcat.stat.exists