prometheus.prometheus Ansible Collection

repository·main·Indexed 20 days ago

https://github.com/prometheus-community/ansible

An Ansible collection providing modules and roles for automating the deployment, configuration, and management of Prometheus and its ecosystem. It includes roles for managing Prometheus Alertmanager and various exporters such as apache_exporter, bind_exporter, blackbox_exporter, cadvisor, and chrony_exporter.

Tokens
13.7K
Snippets
51
Records
86
Agent score
68%

What's inside prometheus.prometheus

  1. Overview of the prometheus.prometheus Ansible Collection

    main
    The prometheus.prometheus collection provides Ansible modules and roles for managing Prometheus and its ecosystem. It is designed to help automate the deployment, configuration, and management of Prometheus instances and related components using Ansible.
  2. Deploy Prometheus Pushgateway using Ansible

    main

    The pushgateway role automates the deployment of the Prometheus pushgateway. It allows you to manage Pushgateway instances via Ansible playbooks, supporting features like TLS configuration and basic authentication.

    Requirements

    • Mac Deployer Host: If deploying from a Mac, you must have gnu-tar installed (brew install gnu-tar).
    • Basic Authentication: If you intend to use the basic authentication feature, passlib and bcrypt must be installed on the target host (python -m pip install passlib bcrypt==4.0.1).
    - hosts: all
      roles:
        - prometheus.prometheus.pushgateway
  3. Deploy mongodb_exporter using Ansible

    main

    This role automates the deployment of the mongodb_exporter to expose MongoDB metrics to Prometheus.

    Requirements

    Before deploying, ensure the following requirements are met:

    • On the Mac deployer host: Install gnu-tar via Homebrew:
      brew install gnu-tar
    • For Basic Authentication: If you intend to use the basic authentication feature, passlib and a specific version of bcrypt must be installed on the target system:
      python -m pip install passlib bcrypt==4.0.1

    Configuration

    All configurable variables are defined in defaults/main.yml and documented in meta/argument_specs.yml. For a complete list of variables and their default values, refer to the official collection documentation.

  4. Deploy and manage Alertmanager with Ansible

    main

    Use the prometheus.prometheus.alertmanager role to deploy and manage the Prometheus Alertmanager service.

    Requirements

    • It is recommended to have Prometheus installed on the system.

    Configuration Variables

    All configurable variables are defined in defaults/main.yml and meta/argument_specs.yml. For a complete list of descriptions and default values, refer to the official collection documentation.

  5. Deploy consul_exporter using Ansible

    main

    The consul_exporter role automates the deployment of the Prometheus consul_exporter.

    Requirements

    • Mac deployer host: Requires gnu-tar (install via brew install gnu-tar).
    • Basic Authentication: If using the basic authentication feature, passlib and bcrypt must be installed on the target: python -m pip install passlib bcrypt==4.0.1.
    - hosts: all
      roles:
        - prometheus.prometheus.consul_exporter
  6. Deploy redis_exporter using Ansible

    main

    This Ansible role automates the deployment of the redis_exporter to expose Redis metrics for Prometheus.

    Requirements

    • If the deployer host is a Mac, you must have gnu-tar installed (brew install gnu-tar).

    Configuration

    All configurable variables are defined in defaults/main.yml and documented in meta/argument_specs.yml. For a full list of variables and their default values, refer to the official collection documentation.

  7. Structure the plugins directory in an Ansible collection

    main

    When developing an Ansible collection, you must organize your custom logic within a plugins directory. Each plugin type must reside in a subdirectory named after its specific type. For standard collection development, you will typically use module_utils for shared Python utilities and modules for the actual Ansible modules.

    Commonly supported plugin directories include:

    • action: Action plugins
    • become: Become plugins
    • cache: Cache plugins
    • callback: Callback plugins
    • cliconf: CLI configuration plugins
    • connection: Connection plugins
    • filter: Filter plugins
    • httpapi: HTTP API plugins
    • inventory: Inventory plugins
    • lookup: Lookup plugins
    • module_utils: Shared module utilities
    • modules: Ansible modules
    • netconf: NETCONF plugins
    • shell: Shell plugins
    • strategy: Strategy plugins
    • terminal: Terminal plugins
    • test: Test plugins
    • vars: Variable plugins
    └── plugins
        ├── action
        ├── become
        ├── cache
        ├── callback
        ├── cliconf
        ├── connection
        ├── filter
        ├── httpapi
        ├── inventory
        ├── lookup
        ├── module_utils
        ├── modules
        ├── netconf
        ├── shell
        ├── strategy
        ├── terminal
        ├── test
        └── vars