wangsha.docker-grafana

Docker-Grafana

Build Status Ansible Galaxy

This is an Ansible role for managing and running the Grafana Docker container.

Requirements

This role has been tested on Ubuntu 14.04. Make sure you have a recent version of docker-py and docker installed, as this role uses Ansible's Docker module.

Examples

To install this module from Ansible Galaxy into the ./roles directory, run:

ansible-galaxy install wangsha.docker-grafana -p ./roles

You can use it in a playbook like this, assuming Docker is already set up:

- hosts: 'servers'
  roles:
    - role: 'wangsha.docker-grafana'
      become: true

Check the defaults/main.yml file for role variables you can change. A complete list of environment variables is available here.

Sample configuration for GitHub signup:

- role: docker-grafana
      docker_grafana_ports:
        - 8080:3000
      docker_grafana_env:
        GF_SECURITY_ADMIN_USER: myadmin
        GF_SECURITY_ADMIN_PASSWORD: myadmin
        GF_USERS_ALLOW_SIGN_UP: true
        GF_SERVER_ROOT_URL: http://localhost:8080/
        GF_AUTH_GITHUB_ALLOW_SIGN_UP: true
        GF_AUTH_GITHUB_ENABLED: true
        GF_AUTH_GITHUB_SCOPES: user:email,read:org
        GF_AUTH_GITHUB_CLIENT_ID: XXXX
        GF_AUTH_GITHUB_CLIENT_SECRET: XXXX
        GF_AUTH_GITHUB_ALLOWED_ORGANIZATIONS: yourgithuborganization

If you need a playbook to set up Docker itself, check out angstwad.docker_ubuntu on Galaxy.

The default Docker image used is grafana/grafana, and the default port is 3000. The admin account is admin/admin.

Custom Volume Mappings

Docker allows you to mount directories or files from the host as data volumes. This role uses host directories to save data from the container and host files to configure the container.

You can control volume mappings with docker_grafana_directory_volumes and docker_grafana_file_volumes. To customize mappings, follow the format <host directory>:<container directory>:<mapping mode> to make sure that host directories are created before launching containers.

To customize file mappings, update docker_grafana_file_volumes. This role will create file parent directories if needed and copy a template to the host machine. The template should be named <host_file_name>.<host_file_extension>.j2. If you want to use your own templates from your Ansible directories, set docker_grafana_template_path.

Example Config:

docker_grafana_file_volumes:
  - '/opt/myapp/conf/settings.conf:/etc/myapp/conf/settings.conf:ro'
docker_grafana_template_path: /path/to/ansible/project/templates/
# Make sure the template /path/to/ansible/project/templates/settings.conf.j2 exists.

Additional References

License

MIT

Author Information

  • wangsha
Informazioni sul progetto

Ansible role to install grafana docker container.

Installa
ansible-galaxy install wangsha.docker-grafana
Licenza
mit
Download
335
Proprietario