|
1 | 1 | --- |
2 | | -- name: add datadog source |
| 2 | +- name: add https transport |
| 3 | + tags: ['datadog'] |
3 | 4 | sudo: yes |
4 | | - lineinfile: |
5 | | - state=present |
6 | | - create=yes |
7 | | - dest=/etc/apt/sources.list.d/datadog.list |
8 | | - line='deb http://apt.datadoghq.com/ stable main' |
| 5 | + apt: |
| 6 | + name=apt-transport-https |
| 7 | + state=latest |
9 | 8 |
|
10 | 9 | - name: add datadog apt key |
| 10 | + tags: ['datadog'] |
11 | 11 | sudo: yes |
12 | 12 | apt_key: |
13 | | - keyserver=keyserver.ubuntu.com |
14 | 13 | id=C7A7DA52 |
15 | | - |
16 | | -- name: install datadog via apt |
17 | | - sudo: yes |
18 | | - apt: |
19 | | - update_cache=yes |
20 | | - name=datadog-agent |
| 14 | + keyserver=keyserver.ubuntu.com |
21 | 15 | state=present |
22 | 16 |
|
23 | | -- name: copy datadog example config into place |
| 17 | +- name: add datadog repository |
| 18 | + tags: ['datadog'] |
24 | 19 | sudo: yes |
25 | | - command: cp datadog.conf.example datadog.conf |
26 | | - chdir=/etc/dd-agent |
27 | | - creates=/etc/dd-agent/datadog.conf |
| 20 | + apt_repository: |
| 21 | + repo='deb http://apt.datadoghq.com/ stable main' |
| 22 | + state=present |
| 23 | + update_cache=yes |
28 | 24 |
|
29 | | -- name: set API key for datadog |
| 25 | +- name: Create main Datadog agent configuration file |
| 26 | + tags: ['datadog'] |
30 | 27 | sudo: yes |
31 | | - lineinfile: " |
32 | | - state=present |
| 28 | + template: |
| 29 | + src=datadog.conf.j2 |
33 | 30 | dest=/etc/dd-agent/datadog.conf |
34 | | - regexp='^api_key:.*$' |
35 | | - line='api_key: 6488896fe0c811965ef233b96809d70d'" |
| 31 | + notify: restart datadog-agent |
36 | 32 |
|
37 | | -- name: (re)start datadog |
| 33 | +- name: install network checks for dock services |
| 34 | + tags: ['datadog'] |
38 | 35 | sudo: yes |
39 | | - service: |
40 | | - name=datadog-agent |
41 | | - state=restarted |
42 | | - |
| 36 | + when: docker_config == "docks" |
| 37 | + template: |
| 38 | + src=tcp_check.yaml.j2 |
| 39 | + dest=/etc/dd-agent/conf.d/tcp_check.yaml |
| 40 | + notify: restart datadog-agent |
| 41 | + |
| 42 | +- name: force restart |
| 43 | + tags: ['datadogg'] |
| 44 | + command: echo restart datadog |
| 45 | + when: force_restart is defined |
| 46 | + notify: restart datadog-agent |
0 commit comments