Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Commit d9ae691

Browse files
wbh1paulfantom
authored andcommitted
Add clarification surrounding when the .rules file is copied & where it goes (#156)
[patch] * Update README with correct location of the .rules file * Add clarification surrounding when the .rules file is copied
1 parent 304f9bd commit d9ae691

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
4040
| `prometheus_targets` | {} | Targets which will be scraped. Better example is provided in our [demo site](https://github.com/cloudalchemy/demo-site/blob/2a8a56fc10ce613d8b08dc8623230dace6704f9a/group_vars/all/vars#L8) |
4141
| `prometheus_scrape_configs` | [defaults/main.yml#L58](https://github.com/cloudalchemy/ansible-prometheus/blob/ff7830d06ba57be1177f2b6fca33a4dd2d97dc20/defaults/main.yml#L47) | Prometheus scrape jobs provided in same format as in [official docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) |
4242
| `prometheus_config_file` | "prometheus.yml.j2" | Variable used to provide custom prometheus configuration file in form of ansible template |
43-
| `prometheus_alert_rules` | [defaults/main.yml#L58](https://github.com/cloudalchemy/ansible-prometheus/blob/ff7830d06ba57be1177f2b6fca33a4dd2d97dc20/defaults/main.yml#L58) | Full list of alerting rules which will be copied to `{{ prometheus_config_dir }}/rules/basic.rules`. Alerting rules can be also provided by other files located in `{{ prometheus_config_dir }}/rules/` which have `*.rules` extension |
43+
| `prometheus_alert_rules` | [defaults/main.yml#L58](https://github.com/cloudalchemy/ansible-prometheus/blob/ff7830d06ba57be1177f2b6fca33a4dd2d97dc20/defaults/main.yml#L58) | Full list of alerting rules which will be copied to `{{ prometheus_config_dir }}/rules/ansible_managed.rules`. Alerting rules can be also provided by other files located in `{{ prometheus_config_dir }}/rules/` which have `*.rules` extension |
4444

4545
### Relation between `prometheus_scrape_configs` and `prometheus_targets`
4646

tasks/preflight.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
# when: not item | basename | splitext | difference(['.yml']) | join('') in prometheus_targets.keys()
3636
with_dict: "{{ prometheus_targets }}"
3737

38+
- name: Fail when prometheus_alertmanager_config is empty, but prometheus_alert_rules is specified
39+
debug:
40+
msg: "There's no use in defining alerting rules if you're not going to use them! Be sure to specify a prometheus_alertmanager_config in defaults/main.yml if you're going to define prometheus_alert_rules"
41+
when:
42+
- prometheus_alertmanager_config == []
43+
- prometheus_alert_rules != []
44+
3845
- block:
3946
- name: Get latest release
4047
uri:

0 commit comments

Comments
 (0)