rolehippie.prometheus
prometheus
Ansible role to install and configure Prometheus.
Sponsor
Building and improving this Ansible role have been sponsored by my current and previous employers like Cloudpunks GmbH and Proact Deutschland GmbH.
Table of content
- Requirements
- Default Variables
- prometheus_alertmanagers
- prometheus_cpu_shares
- prometheus_default_folders
- prometheus_default_labels
- prometheus_default_publish
- prometheus_default_rules
- prometheus_default_volumes
- prometheus_domain
- prometheus_download
- prometheus_enable_remote_write_receiver
- prometheus_evaluation_interval
- prometheus_extra_folders
- prometheus_extra_labels
- prometheus_extra_publish
- prometheus_extra_rules
- prometheus_extra_volumes
- prometheus_image
- prometheus_installation
- prometheus_listen_address
- prometheus_memory_limit
- prometheus_memory_soft_limit
- prometheus_memory_swap
- prometheus_network
- prometheus_number_of_cpus
- prometheus_oauth2_access_logging
- prometheus_oauth2_allowed_groups
- prometheus_oauth2_client_id
- prometheus_oauth2_client_secret
- prometheus_oauth2_cookie_secret
- prometheus_oauth2_cpu_shares
- prometheus_oauth2_default_labels
- prometheus_oauth2_default_publish
- prometheus_oauth2_download
- prometheus_oauth2_enabled
- prometheus_oauth2_extra_labels
- prometheus_oauth2_extra_publish
- prometheus_oauth2_image
- prometheus_oauth2_keycloak_url
- prometheus_oauth2_listen_address
- prometheus_oauth2_memory_limit
- prometheus_oauth2_memory_soft_limit
- prometheus_oauth2_memory_swap
- prometheus_oauth2_network
- prometheus_oauth2_number_of_cpus
- prometheus_oauth2_provider
- prometheus_oauth2_pull_image
- prometheus_oauth2_request_logging
- prometheus_oauth2_static_groups
- prometheus_oauth2_static_users
- prometheus_oauth2_upstream
- prometheus_oauth2_version
- prometheus_pull_image
- prometheus_rule_files
- prometheus_scrape_configs
- prometheus_scrape_interval
- prometheus_tsdb_retention_size
- prometheus_tsdb_retention_time
- prometheus_version
- Discovered Tags
- Dependencies
- License
- Author
Requirements
- Minimum Ansible version:
2.10
Default Variables
prometheus_alertmanagers
List of alertmanager configuration
Default value
prometheus_alertmanagers: []
Example usage
prometheus_alertmanagers:
- scheme: http
static_configs:
- targets:
- loclhost:9093
prometheus_cpu_shares
CPU shares with Docker deployment
Default value
prometheus_cpu_shares:
Example usage
prometheus_cpu_shares: '512'
prometheus_default_folders
List of default folders to create
Default value
prometheus_default_folders:
- /etc/prometheus
- /etc/prometheus/rules
- /var/lib/prometheus
prometheus_default_labels
List of default labels to assign to docker
Default value
prometheus_default_labels: []
prometheus_default_publish
List of default port publishing for docker
Default value
prometheus_default_publish: []
Example usage
prometheus_default_publish:
- 127.0.0.1:9090:9090
prometheus_default_rules
List of default rule file definitions
Default value
prometheus_default_rules: []
Example usage
prometheus_default_rules:
- name: example
content:
groups:
- name: example
rules:
- alert: ...
expr: ...
for: 5m
- name: example-from-url
url: http://example.com/example.yml
- name: example-from-template
src: path/to/template.j2
- name: example-to-remove
state: absent
prometheus_default_volumes
List of default volumes to mount for docker
Default value
prometheus_default_volumes:
- /var/lib/prometheus:/var/lib/prometheus
- /etc/prometheus/rules:/etc/prometheus/rules
prometheus_domain
Domain for external access
Default value
prometheus_domain:
Example usage
prometheus_domain: https://prometheus.example.com
prometheus_download
URL to the archive of the release to install
Default value
prometheus_download: https://github.com/prometheus/prometheus/releases/download/v{{
prometheus_version }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz
prometheus_enable_remote_write_receiver
Enable remote-write receiver in Prometheus
Default value
prometheus_enable_remote_write_receiver: false
prometheus_evaluation_interval
Global default evaluation interval
Default value
prometheus_evaluation_interval: 15s
prometheus_extra_folders
List of extra folders to create
Default value
prometheus_extra_folders: []
Example usage
prometheus_extra_folders:
- /path/to/host/folder1
- /path/to/host/folder2
- /path/to/host/folder3
prometheus_extra_labels
List of extra labels to assign to docker
Default value
prometheus_extra_labels: []
prometheus_extra_publish
List of extra port publishing for docker
Default value
prometheus_extra_publish: []
Example usage
prometheus_extra_publish:
- 127.0.0.1:9000:9000
prometheus_extra_rules
List of extra rule file definitions
Default value
prometheus_extra_rules: []
Example usage
prometheus_extra_rules:
- name: example
content:
groups:
- name: example
rules:
- alert: ...
expr: ...
for: 5m
- name: example-from-url
url: http://example.com/example.yml
- name: example-from-template
src: path/to/template.j2
- name: example-to-remove
state: absent
prometheus_extra_volumes
List of extra volumes to mount for docker
Default value
prometheus_extra_volumes: []
Example usage
prometheus_extra_volumes:
- /path/to/host/folder1:/path/within/container1
- /path/to/host/folder2:/path/within/container2
- /path/to/host/folder3:/path/within/container3
prometheus_image
Docker image to use for deployment on OAuth2 Proxy
Default value
prometheus_image: quay.io/prometheus/prometheus:v{{ prometheus_version }}
prometheus_installation
Select installation method, could be native or docker
Default value
prometheus_installation: native
prometheus_listen_address
Listen address for the prometheus
Default value
prometheus_listen_address: 0.0.0.0:9090
prometheus_memory_limit
Memory limit with Docker deployment
Default value
prometheus_memory_limit:
Example usage
prometheus_memory_limit: 1024m
prometheus_memory_soft_limit
Soft memory limit with Docker deployment
Default value
prometheus_memory_soft_limit:
Example usage
prometheus_memory_soft_limit: 512m
prometheus_memory_swap
Swap usage with Docker deployment
Default value
prometheus_memory_swap:
Example usage
prometheus_memory_swap: 2048m
prometheus_network
Optional docker network to attach on OAuth2 Proxy
Default value
prometheus_network:
prometheus_number_of_cpus
Number of CPUs with Docker deployment
Default value
prometheus_number_of_cpus:
Example usage
prometheus_number_of_cpus: '1.0'
prometheus_oauth2_access_logging
Enable access logging for OAuth2 proxy
Default value
prometheus_oauth2_access_logging: false
prometheus_oauth2_allowed_groups
List of groups to allow access
Default value
prometheus_oauth2_allowed_groups: []
Example usage
prometheus_oauth2_allowed_groups:
- /Group1
- /Group2
- /Group3
prometheus_oauth2_client_id
Client ID for OAuth2 authentication
Default value
prometheus_oauth2_client_id:
prometheus_oauth2_client_secret
Client secret for OAuth2 authentication
Default value
prometheus_oauth2_client_secret:
prometheus_oauth2_cookie_secret
Cookie secret used by OAuth2 proxy
Default value
prometheus_oauth2_cookie_secret:
prometheus_oauth2_cpu_shares
CPU shares with Docker deployment
Default value
prometheus_oauth2_cpu_shares:
Example usage
prometheus_oauth2_cpu_shares: '512'
prometheus_oauth2_default_labels
List of default labels to assign to docker on OAuth2 Proxy
Default value
prometheus_oauth2_default_labels: []
prometheus_oauth2_default_publish
List of default port publishing for docker on OAuth2 Proxy
Default value
prometheus_oauth2_default_publish: []
Example usage
prometheus_oauth2_default_publish:
- 127.0.0.1:9089:9089
prometheus_oauth2_download
Default value
prometheus_oauth2_download: https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v{{
prometheus_oauth2_version }}/oauth2-proxy-v{{ prometheus_oauth2_version }}.linux-amd64.tar.gz
prometheus_oauth2_enabled
URL of the OAuth2 Proxy to download
Default value
prometheus_oauth2_enabled: false
prometheus_oauth2_extra_labels
List of extra labels to assign to docker on OAuth2 Proxy
Default value
prometheus_oauth2_extra_labels: []
prometheus_oauth2_extra_publish
List of extra port publishing for docker on OAuth2 Proxy
Default value
prometheus_oauth2_extra_publish: []
Example usage
prometheus_oauth2_extra_publish:
- 127.0.0.1:9089:9089
prometheus_oauth2_image
Default value
prometheus_oauth2_image: quay.io/oauth2-proxy/oauth2-proxy:v{{ prometheus_oauth2_version
}}
prometheus_oauth2_keycloak_url
URL of the Keycloak realm
Default value
prometheus_oauth2_keycloak_url:
prometheus_oauth2_listen_address
Listem address for the OAuth2 proxy
Default value
prometheus_oauth2_listen_address: 0.0.0.0:9089
prometheus_oauth2_memory_limit
Memory limit with Docker deployment
Default value
prometheus_oauth2_memory_limit:
Example usage
prometheus_oauth2_memory_limit: 1024m
prometheus_oauth2_memory_soft_limit
Soft memory limit with Docker deployment
Default value
prometheus_oauth2_memory_soft_limit:
Example usage
prometheus_oauth2_memory_soft_limit: 512m
prometheus_oauth2_memory_swap
Swap usage with Docker deployment
Default value
prometheus_oauth2_memory_swap:
Example usage
prometheus_oauth2_memory_swap: 2048m
prometheus_oauth2_network
Default value
prometheus_oauth2_network: '{{ prometheus_network }}'
prometheus_oauth2_number_of_cpus
Number of CPUs with Docker deployment
Default value
prometheus_oauth2_number_of_cpus:
Example usage
prometheus_oauth2_number_of_cpus: '1.5'
prometheus_oauth2_provider
Provider for OAuth2 authentication
Default value
prometheus_oauth2_provider: keycloak
prometheus_oauth2_pull_image
Default value
prometheus_oauth2_pull_image: true
prometheus_oauth2_request_logging
Enable request logging for OAuth2 proxy
Default value
prometheus_oauth2_request_logging: false
prometheus_oauth2_static_groups
List of groups assigned to static users
Default value
prometheus_oauth2_static_groups: []
prometheus_oauth2_static_users
List of users to allow access
Default value
prometheus_oauth2_static_users: []
Example usage
prometheus_oauth2_static_users:
- username: username1
password: p455w0rd
- username: username2
password: p455w0rd
- username: username3
password: p455w0rd
prometheus_oauth2_upstream
Upstream target for the OAuth2 proxy
Default value
prometheus_oauth2_upstream: http://{{ prometheus_listen_address if prometheus_installation
== 'native' else 'prometheus:9090' }}
prometheus_oauth2_version
Version of the OAuth2 Proxy to download
Default value
prometheus_oauth2_version: 7.6.0
prometheus_pull_image
Pull image as part of the tasks
Default value
prometheus_pull_image: true
prometheus_rule_files
List of paths to read rule files from
Default value
prometheus_rule_files:
- /etc/prometheus/rules/*.yml
prometheus_scrape_configs
List of scrape configuration
Default value
prometheus_scrape_configs: []
Example usage
prometheus_scrape_configs:
- job_name: prometheus
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9090
prometheus_scrape_interval
Global default scrape interval
Default value
prometheus_scrape_interval: 15s
prometheus_tsdb_retention_size
Retention size to define the maximum size of the data
Default value
prometheus_tsdb_retention_size:
prometheus_tsdb_retention_time
Retention time to define the maximum age of the data
Default value
prometheus_tsdb_retention_time: 30d
prometheus_version
Version of the release to install
Default value
prometheus_version: 2.54.1
Discovered Tags
oauth2
prometheus
Dependencies
License
Apache-2.0
Author
ansible-galaxy install rolehippie.prometheus