wangsha.docker-graphite
docker-graphite
This is an Ansible role designed to manage and run a Graphite Docker container.
Requirements
This role has been tested on Ubuntu 14.04. You'll need to have a fairly recent version of docker-py
and docker
installed since it uses Ansible's Docker module.
Examples
To install this module from Ansible Galaxy into the './roles' directory, use:
ansible-galaxy install wangsha.docker-graphite -p ./roles
You can use it in a playbook like this, assuming that Docker is already set up:
- hosts: 'servers'
roles:
- role: 'wangsha.docker-graphite'
become: true
graphite_storage_schemas_extra:
statsd: |
priority = 110
pattern = ^stats.*
retentions = 10s:6h,1m:7d,10m:1y
Check the defaults/main.yml file for role variables that you can change.
If you need a playbook to set up Docker, check out the angstwad.docker_ubuntu Galaxy role.
The default Docker image used is hopsoft/graphite-statsd. This image includes both Graphite and StatsD. To disable StatsD, simply remove the relevant port mappings. The basic authentication account is root/root
. You can change the default accounts by modifying docker_graphite_htpasswd_users
.
Custom Volume Mappings
Docker lets you mount a host directory or file as a data volume. This role mounts host directories to keep container data and host files to set up container behavior. Use docker_graphite_directory_volumes
and docker_graphite_file_volumes
to manage these volume mappings.
If you want to customize the mapping, use the format <host directory>:<container directory>:<mapping mode>
and ensure that the host directories are created before starting the containers.
To adjust host file mappings, update docker_graphite_file_volumes
. This role will create necessary parent directories for files and copy templates to the host machine. The template filename should be <host_file_name>.<host_file_extension>.j2
. To use your own templates, set docker_graphite_template_path
.
Example Configuration:
docker_graphite_file_volumes:
- '/opt/myapp/conf/settings.conf:/etc/myapp/conf/settings.conf:ro'
docker_graphite_template_path: /path/to/ansible/project/templates/
# Make sure the file /path/to/ansible/project/templates/settings.conf.j2 exists.
License
Author Information
- wangsha
Ansible role to install graphite docker container.
ansible-galaxy install wangsha.docker-graphite