Skip to content

Ansible role to run Prometheus/Alertmanager/Grafana monitoring stack via Docker

Notifications You must be signed in to change notification settings

vi7/ansible-role-monitoring-stack

Repository files navigation

Ansible Role: Containerized monitoring stack

Role to run containerized monitoring stack via standalone Docker containers.

Deploys the following:

!! WARNING: !! This role installs Python 3 and Docker SDK for Python packages to the target host(s) automatically!

Requirements

N/A

Role Variables

See defaults/main.yml for the full variable list and their description

Dependencies

See meta dir

Example Playbook

Clone this repo to your local role path or install via Ansible Galaxy

Create my_playbook.yml with the following contents:

- hosts: my-awesome-host
  roles:
    - role: monitoring_stack
      # Uncomment the key below to override role vars
      # vars:
      #   prometheus_version: v2.26.0

And then run playbook - this will run node-exporter container on the awesome host:

ansible-playbook -v my_playbook.yml

Container restart and/or re-creation can be forced by overriding role default vars. Example for the Prometheus:

ansible-playbook -v my_playbook.yml --extra-vars "prometheus_container_restart=true prometheus_container_recreate=true"

Specific services deployment could be switched on/off using tags. For example to install only required packages and node_exporter run:

ansible-playbook --tags "packages,node_exporter" my_playbook.yml

Development

Role testing

Script test.sh activates Python virtualenv, installs all the required Python packages and executes linter.

More comprehensive functional tests could be executed like following:

source venv/bin/activate
molecule test

Author Information

vi7

About

Ansible role to run Prometheus/Alertmanager/Grafana monitoring stack via Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published