7
7
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
8
8
# license: https://github.com/openedx/configuration/blob/master/LICENSE.TXT
9
9
#
10
- # newrelic_infrastructure
11
- #
12
- # Overview:
13
- #
14
- # Installs the New Relic Infrastructure service https://newrelic.com/infrastructure
15
- # #
16
- # Dependencies:
17
- #
18
- # Example play:
19
- # roles:
20
- # - common
21
- # - newrelic_infrastructure
22
- #
23
- #
24
- - name : install license key
25
- template :
26
- src : etc/newrelic-infra.j2
27
- dest : /etc/newrelic-infra.yml
28
- mode : 0600
29
- register : license_key_file
30
- tags :
31
- - install
32
- - install:configuration
33
-
34
- - name : Add apt key for New Relic Infrastructure
35
- apt_key :
36
- url : " {{ NEWRELIC_INFRASTRUCTURE_KEY_URL }}"
37
- state : present
38
- tags :
39
- - install
40
- - install:app-requirements
41
- when : ansible_distribution == 'Ubuntu'
42
- retries : 10
43
- delay : 10
44
- register : nr_apt_key
45
- until : nr_apt_key is succeeded
46
-
47
- # For focal, use the bionic repo for now.
48
- - name : Install apt repository for New Relic Infrastructure if neither bionic nor focal
49
- apt_repository :
50
- repo : " {{ NEWRELIC_INFRASTRUCTURE_DEBIAN_REPO }}"
51
- state : present
52
- update_cache : yes
53
- tags :
54
- - install
55
- - install:app-requirements
56
- when : ansible_distribution == 'Ubuntu' and (ansible_distribution_release != 'bionic' and ansible_distribution_release != 'focal')
57
- retries : 10
58
- delay : 10
59
- register : nr_apt_repo
60
- until : nr_apt_repo is succeeded
61
-
62
- - name : Install apt repository for New Relic Infrastructure if bionic
63
- apt_repository :
64
- repo : " {{ NEWRELIC_INFRASTRUCTURE_DEBIAN_REPO_BIONIC }}"
65
- state : present
66
- update_cache : yes
67
- tags :
68
- - install
69
- - install:app-requirements
70
- when : ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'bionic'
71
- retries : 10
72
- delay : 10
73
- register : nr_apt_repo_bionic
74
- until : nr_apt_repo_bionic is succeeded
75
10
76
- # For focal, use the bionic repo for now.
77
- - name : Install apt repository for New Relic Infrastructure if focal
78
- apt_repository :
79
- repo : " {{ NEWRELIC_INFRASTRUCTURE_DEBIAN_REPO_BIONIC }}"
80
- state : present
81
- update_cache : yes
82
- tags :
83
- - install
84
- - install:app-requirements
85
- when : ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'focal'
86
- retries : 10
87
- delay : 10
88
- register : nr_apt_repo_focal
89
- until : nr_apt_repo_focal is succeeded
90
-
91
- - name : Install newrelic related system packages for Ubuntu
92
- apt :
93
- name : " {{ newrelic_infrastructure_debian_pkgs }}"
94
- install_recommends : yes
95
- state : latest
96
- tags :
97
- - install
98
- - install:app-requirements
99
- when : ansible_distribution == 'Ubuntu'
100
- retries : 10
101
- delay : 10
102
- register : nr_apt_pkg
103
- until : nr_apt_pkg is succeeded
104
-
105
- - name : Configure the New Relic Servers yum repository
106
- yum_repository :
107
- name : " newrelic-infra"
108
- baseurl : " {{ NEWRELIC_INFRASTRUCTURE_AMAZON_REPO }}"
109
- gpgkey : " {{ NEWRELIC_INFRASTRUCTURE_KEY_URL }}"
110
- gpgcheck : " yes"
111
- state : present
112
- description : New Relic Infrastructure
113
- tags :
114
- - install
115
- - install:app-requirements
116
- when : ansible_distribution == 'Amazon'
117
- retries : 10
118
- delay : 10
119
- register : nr_yum_repo
120
- until : nr_yum_repo is succeeded
121
-
122
- - name : Install newrelic related system packages for Amazon
123
- yum :
124
- name : " {{ newrelic_infrastructure_redhat_pkgs }}"
125
- enablerepo : " newrelic-infra"
126
- state : latest
127
- update_cache : yes
128
- tags :
129
- - install
130
- - install:app-requirements
131
- when : ansible_distribution == 'Amazon'
132
- retries : 10
133
- delay : 10
134
- register : nr_yum_pkg
135
- until : nr_yum_pkg is succeeded
136
-
137
- - name : Install newrelic display name script
138
- copy :
139
- src : " edx/bin/write_nr_display_name_config.sh"
140
- dest : " /edx/bin/write_nr_display_name_config.sh"
141
- owner : root
142
- group : root
143
- mode : u=rwx,g=r,o=r
144
-
145
- - name : configure logging
146
- template :
147
- src : etc/newrelic-infra/logging.d/logs.yml.j2
148
- dest : /etc/newrelic-infra/logging.d/logs.yml
149
- mode : 0600
150
- tags :
151
- - install
152
- - install:configuration
153
- when : NEWRELIC_LOGS
11
+ #
154
12
155
13
156
14
# In Ubuntu>16.04, /etc/rc.local doesn't exist by default. Since this script isn't
157
15
# used by the GoCD instance using Ubuntu 18.04, skip this task when running on Bionic.
158
- # See OPS-3341 and http://manpages.ubuntu.com/manpages/bionic/man8/systemd-rc-local-generator.8.html
159
- - name : Run newrelic display name script on boot
160
- lineinfile :
161
- dest : " /etc/rc.local"
162
- line : " /edx/bin/write_nr_display_name_config.sh"
163
- insertbefore : " exit 0"
164
- mode : " u+x,g+x"
165
- when : ansible_distribution_release != 'bionic' and ansible_distribution_release != 'focal'
166
-
167
- - name : Restart the infrastructure agent if the license key changes
168
- service :
169
- name : newrelic-infra
170
- state : restarted
171
- when : license_key_file.changed
172
- tags :
173
- - install
174
- - install:configuration
16
+ # See OPS-3341 and http://manpages.ubuntu.com/manpages/bionic/man8/systemd-rc-local-generator.8.html
0 commit comments