setup datadog agent on each host.

- set agent version to 7
This commit is contained in:
2022-01-22 14:59:15 -05:00
parent 449eb42c36
commit f723e4ac2e
61 changed files with 3661 additions and 0 deletions

View File

@@ -0,0 +1 @@
.vagrant

View File

@@ -0,0 +1,3 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
end

View File

@@ -0,0 +1,2 @@
[test_host]
127.0.0.1 ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2222 ansible_ssh_private_key_file=./ansible-datadog/manual_tests/.vagrant/machines/default/virtualbox/private_key

View File

@@ -0,0 +1,9 @@
[windows]
win ansible_host=127.0.0.1
[windows:vars]
ansible_user=Administrator
ansible_become=no
ansible_connection=winrm
ansible_port=5986
ansible_winrm_server_cert_validation=ignore

View File

@@ -0,0 +1,44 @@
# Linux test setup with Vagrant
This is an example setup, based on vagrant + virtualbox, that allows to easily run ansible commands to test the module.
## Requirements
- vagrant > 2.0.0
- virtualbox > 5.1.28
## Setup
Run the Vagrantfile defined in `ansible-datadog/manual_tests`:
- provision VM: `vagrant up`
- connect to the VM to check the configuration: `vagrant ssh`
- when done, destroy VM when needed: `vagrant destroy -f`
- From `ansible-datadog`'s parent directory, run:
```shell
ansible-playbook ansible-datadog/manual_tests/test_7_full.yml -i ansible-datadog/manual_tests/inventory
```
Note: Replace `test_7_full.yml` with any of the other yaml files on this directory.
Note: If getting access denied errors, make sure Vagrant is forwarding the VM port 22 to the local port 2222. If using a different port, update the 'inventory' file
# Windows test setup from WSL
## Requirements
- Install Ansible and `pywinrm` inside WSL: `sudo python3 -m pip install ansible pywinrm`
- From an elevated Powershell terminal (outside WSL), run the following script to setup WinRM so Ansible can connect:
https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
- Make sure the Administrator account is enabled and you know the password (or use a different account in the `inventory_win` file).
## Setup
- From `ansible-datadog`'s parent directory, run in a WSL console (it will ask for the Administrator password each time):
```shell
ansible-playbook -k ansible-datadog/manual_tests/test_7_full.yml -i ansible-datadog/manual_tests/inventory_win
```
Note: Replace `test_7_full.yml` with any of the other yaml files on this directory.

View File

@@ -0,0 +1,6 @@
---
- hosts: all
roles:
- { role: ansible-datadog, become: yes }
vars:
datadog_agent_major_version: 5

View File

@@ -0,0 +1,47 @@
- hosts: all
roles:
- { role: ansible-datadog, become: yes } # On Ansible < 1.9, use `sudo: yes` instead of `become: yes`
vars:
datadog_agent_major_version: 5
datadog_api_key: "123456"
datadog_agent_version: "1:5.18.0-1" # for apt-based platforms, use a `5.12.3-1` format on yum-based platforms
datadog_agent_allow_downgrade: true
datadog_config:
tags: "mytag0, mytag1"
log_level: INFO
apm_enabled: "true" # has to be set as a string
datadog_config_ex:
trace.config:
env: dev
trace.concentrator:
extra_aggregators: version
datadog_checks:
process:
init_config:
instances:
- name: ssh
search_string: ['ssh', 'sshd' ]
- name: syslog
search_string: ['rsyslog' ]
cpu_check_interval: 0.2
exact_match: true
ignore_denied_access: true
ssh_check:
init_config:
instances:
- host: localhost
port: 22
username: root
password: changeme
sftp_check: True
private_key_file:
add_missing_keys: True
nginx:
init_config:
instances:
- nginx_status_url: http://example.com/nginx_status/
tags:
- instance:foo
- nginx_status_url: http://example2.com:1234/nginx_status/
tags:
- instance:bar

View File

@@ -0,0 +1,6 @@
---
- hosts: all
roles:
- { role: ansible-datadog, become: yes }
vars:
datadog_agent_major_version: 6

View File

@@ -0,0 +1,75 @@
- hosts: all
roles:
- { role: ansible-datadog, become: yes } # On Ansible < 1.9, use `sudo: yes` instead of `become: yes`
vars:
datadog_agent_major_version: 6
datadog_api_key: "123456"
datadog_agent_allow_downgrade: true
system_probe_config:
source_excludes:
"*":
- 8301
dest_excludes:
"*":
- 8301
network_config:
enabled: true
datadog_config:
tags: "mytag0, mytag1"
log_level: INFO
apm_enabled: "true" # has to be set as a string
# logs related config
logs_enabled: true
logset: main
datadog_config_ex:
trace.config:
env: dev
trace.concentrator:
extra_aggregators: version
datadog_checks:
process:
init_config:
instances:
- name: ssh
search_string: ['ssh', 'sshd' ]
- name: syslog
search_string: ['rsyslog' ]
cpu_check_interval: 0.2
exact_match: true
ignore_denied_access: true
ssh_check:
init_config:
instances:
- host: localhost
port: 22
username: root
password: changeme
sftp_check: True
private_key_file:
add_missing_keys: True
nginx:
init_config:
instances:
- nginx_status_url: http://example.com/nginx_status/
tags:
- instance:foo
- nginx_status_url: http://example2.com:1234/nginx_status/
tags:
- instance:bar
logs:
- type: file
path: /var/log/nginx.log
service: nginx
source: nginx
sourcecategory: webapp
tags: env:prod
- type: tcp
port: 10514
service: webapp
source: php
sourcecategory: front
log_processing_rules:
- type: exclude_at_match
name: exclude_datadoghq_users
# Regexp can be anything
pattern: User=\w+@datadoghq.com

View File

@@ -0,0 +1,4 @@
---
- hosts: all
roles:
- { role: ansible-datadog, become: yes }

View File

@@ -0,0 +1,80 @@
- hosts: all
roles:
- { role: ansible-datadog, become: yes } # On Ansible < 1.9, use `sudo: yes` instead of `become: yes`
vars:
datadog_agent_major_version: 7
datadog_api_key: "123456"
datadog_agent_allow_downgrade: true
system_probe_config:
source_excludes:
"*":
- 8301
dest_excludes:
"*":
- 8301
network_config:
enabled: true
datadog_config:
tags: "mytag0, mytag1"
log_level: INFO
apm_enabled: "true" # has to be set as a string
# logs related config
logs_enabled: true
logset: main
datadog_config_ex:
trace.config:
env: dev
trace.concentrator:
extra_aggregators: version
datadog_integration:
datadog-aqua:
action: 'install'
version: '1.0.0'
third_party: true
datadog_checks:
process:
init_config:
instances:
- name: ssh
search_string: ['ssh', 'sshd' ]
- name: syslog
search_string: ['rsyslog' ]
cpu_check_interval: 0.2
exact_match: true
ignore_denied_access: true
ssh_check:
init_config:
instances:
- host: localhost
port: 22
username: root
password: changeme
sftp_check: True
private_key_file:
add_missing_keys: True
nginx:
init_config:
instances:
- nginx_status_url: http://example.com/nginx_status/
tags:
- instance:foo
- nginx_status_url: http://example2.com:1234/nginx_status/
tags:
- instance:bar
logs:
- type: file
path: /var/log/nginx.log
service: nginx
source: nginx
sourcecategory: webapp
tags: env:prod
- type: tcp
port: 10514
service: webapp
source: php
sourcecategory: front
log_processing_rules:
- type: exclude_at_match
name: exclude_datadoghq_users
# Regexp can be anything
pattern: User=\w+@datadoghq.com