-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathagent-upgrade.yml
78 lines (64 loc) · 2.33 KB
/
agent-upgrade.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
---
- name: agent-upgrade
hosts: testing_hosts_linux
become: true
gather_facts: yes
pre_tasks:
- name: Initial cleanup
include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
tasks:
- name: agent upgrade tests suite
# TODO: https://new-relic.atlassian.net/browse/NR-355851 Update when two releases with FIPS are done
# Also add FIPS tests
vars:
target_agent_version: "1.57.1"
block:
- name: install agent
include_role:
name: caos.ansible_roles.infra_agent
vars:
target_version: "{{ target_agent_version }}"
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
- name: Assert version
include_role:
name: caos.ansible_roles.assert_version
vars:
target_versions:
- exec: "/usr/bin/newrelic-infra --version"
version: "{{ target_agent_version }}"
- name: get initial agent PID
command: pgrep -f newrelic-infra-service
register: agent_pid
- name: install latest agent
include_role:
name: caos.ansible_roles.infra_agent
vars:
install_only_if_present: "yes"
- name: assert service countinues running after upgrade
include_role:
name: caos.ansible_roles.assert_service_status
vars:
services_running:
- "newrelic-infra.service"
- name: get agent PID after upgrade
command: pgrep -f newrelic-infra-service
register: updated_agent_pid
- name: assert agent has been reloaded
assert:
that: agent_pid.stdout != updated_agent_pid.stdout
- name: register installed version
shell: "newrelic-infra --version | egrep -o 'New Relic Infrastructure Agent version: [0-9\\.]+' | egrep -o '[0-9\\.]+'"
register: installed_version
- name: assert installed version is bigger than initial version
assert:
that: "{{ installed_version.stdout is version(target_agent_version, '>') }}"
always:
- name: Final cleanup
include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
...