-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.yml
More file actions
72 lines (59 loc) · 2.21 KB
/
agent.yml
File metadata and controls
72 lines (59 loc) · 2.21 KB
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
---
- hosts: agents
become: yes
remote_user: "{{ ansible_user }}"
vars_files:
- vars/main-vars.yml
tasks:
- name: get download token from appdynamics official site
shell: "curl -X POST -d '{\"username\": \"{{ appdynamics_user }}\",\"password\": \"{{ appdynamics_password }}\",\"scopes\": [\"download\"]}' {{ appd_auth_url }}"
register: appd_token
run_once: true
delegate_to: 127.0.0.1
- set_fact:
appd_token_value: "{{ appd_token.stdout|from_json}}"
- debug:
var: appd_token_value.access_token
- name: Download machine agent
shell: "curl -L -O -H \"Authorization: Bearer {{ appd_token_value.access_token}}\" {{ mach_agent_download_url }}"
args:
chdir: "{{ appd_tmp_dir }}"
run_once: true
delegate_to: 127.0.0.1
- name: Set permission for machine agent
file:
path: "{{ appd_tmp_dir }}{{ mach_agent_version }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_group }}"
mode: "0775"
delegate_to: 127.0.0.1
- name: create machine agent installation dir
file:
path: "{{ mach_agent_installation_dir }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_group }}"
mode: "0775"
- name: Unarchive machine agent at installation path
unarchive:
src: "{{ appd_tmp_dir }}{{ mach_agent_version }}"
dest: "{{ mach_agent_installation_dir }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_group }}"
mode: 0775
- name: replace configuration file
template:
src: "templates/machine-agent/controller-info.xml.j2"
dest: "{{ mach_agent_installation_dir }}/conf/controller-info.xml"
owner: "{{ ansible_user }}"
group: "{{ ansible_group }}"
mode: '0775'
- name: create machine agent log dir
file:
path: "{{ appd_logs_dir }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_group }}"
mode: "0775"
- name: start the machine agent
shell: runuser -l "{{ ansible_user }}" -c "nohup /usr/bin/java -jar {{ mach_agent_installation_dir }}/machineagent.jar >> {{ appd_logs_dir }}/appdlog 2>&1 &"