Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vagrant
*.retry
3 changes: 3 additions & 0 deletions tests/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
end
2 changes: 2 additions & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -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/tests/.vagrant/machines/default/virtualbox/private_key
20 changes: 20 additions & 0 deletions tests/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Test setup

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
- vitrualbox > 5.1.28

# Setup

in `$WORK_DIR/ansible-datadog/tests`:

- provision VM: `vagrant up`
- connect to the VM to check the configuration: `vagrant ssh`
- destroy VM when needed: `vagrant destroy -f`

in `$WORK_DIR`:

- run ansible-playbook: `ansible-playbook ansible-datadog/tests/test_5_full.yml -i ansible-datadog/tests/inventory`
2 changes: 1 addition & 1 deletion tests/test.yml → tests/test_5_default.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
- hosts: localhost
- hosts: all
roles:
- { role: ansible-datadog, become: yes }
46 changes: 46 additions & 0 deletions tests/test_5_full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- hosts: all
roles:
- { role: ansible-datadog, become: yes } # On Ansible < 1.9, use `sudo: yes` instead of `become: yes`
vars:
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
6 changes: 6 additions & 0 deletions tests/test_6_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all
roles:
- { role: ansible-datadog, become: yes }
vars:
datadog_agent6: true
66 changes: 66 additions & 0 deletions tests/test_6_full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
- hosts: all
roles:
- { role: ansible-datadog, become: yes } # On Ansible < 1.9, use `sudo: yes` instead of `become: yes`
vars:
datadog_agent6: true
datadog_api_key: "123456"
datadog_agent_allow_downgrade: true
datadog_config:
tags: "mytag0, mytag1"
log_level: INFO
apm_enabled: "true" # has to be set as a string
# logs related config
log_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