Skip to content

Commit

Permalink
Run ansible-lint and yamllint
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestas-poskus committed May 7, 2019
1 parent d955021 commit 931fcde
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 16 deletions.
3 changes: 2 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# handlers file for ansible-prometheus

- name: reload daemon
command: systemctl daemon-reload
systemd:
daemon_reload: yes

- name: restart prometheus
service: name=prometheus state=restarted enabled=yes
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ galaxy_info:

license: BSD

min_ansible_version: 2.1
min_ansible_version: 2.4

platforms:
- name: EL
Expand Down
7 changes: 4 additions & 3 deletions tasks/install-alert_manager.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'alertmanager.yml'
- name: Include alert manager variables
include_vars: 'alertmanager.yml'

- name: Creating alert manager directories
file:
Expand All @@ -22,15 +23,15 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_alert_manager_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Copy alert manager config
template:
src: alertmanager.yml.j2
dest: "{{ prometheus_alert_manager_config_dir }}/alertmanager.yml"
owner: "{{ prometheus_owner }}"
group: "{{ prometheus_group }}"
validate: "{{ prometheus_install_dir }}/{{ prometheus_alert_manager_archive }}/amtool check-config %s --alertmanager.url={% if prometheus_alert_manager_web__external_url is not none %}{{ prometheus_alert_manager_web__external_url }}{% else %}'http://127.0.0.1:9093'{% endif %}"
validate: "{{ prometheus_install_dir }}/{{ prometheus_alert_manager_archive }}/amtool check-config %s --alertmanager.url={{ _alert_manager_validate_url }}"
notify:
restart alertmanager

Expand Down
7 changes: 4 additions & 3 deletions tasks/install-blackbox_exporter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'blackboxexporter.yml'
- name: Include blackbox exporter variables
include_vars: 'blackboxexporter.yml'

- name: Creating blackbox exporter directories
file:
Expand All @@ -19,7 +20,7 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_blackbox_exporter_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Copy blackbox exporter config
template:
Expand All @@ -35,7 +36,7 @@
path: "{{ prometheus_install_dir }}/{{ prometheus_blackbox_exporter_archive }}/blackbox_exporter"
capability: cap_net_raw+ep
state: present
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"
notify:
- reload blackboxexporter

Expand Down
5 changes: 3 additions & 2 deletions tasks/install-node_exporter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'nodeexporter.yml'
- name: Include node exporter variables
include_vars: 'nodeexporter.yml'

- name: Download and extract Prometheus node exporter tarball
unarchive:
Expand All @@ -8,7 +9,7 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_node_exporter_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Install Prometheus node exporter systemd service
template:
Expand Down
5 changes: 3 additions & 2 deletions tasks/install-prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'prometheus.yml'
- name: Include prometheus variables
include_vars: 'prometheus.yml'

- name: Creating Prometheus directories
file:
Expand All @@ -21,7 +22,7 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Copy Prometheus config
template:
Expand Down
5 changes: 3 additions & 2 deletions tasks/install-push_gateway.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'pushgateway.yml'
- name: Include pushgateway variables
include_vars: 'pushgateway.yml'

- name: Download and extract Prometheus push gateway tarball
unarchive:
Expand All @@ -8,7 +9,7 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_push_gateway_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Install Prometheus push gateway systemd service
template:
Expand Down
5 changes: 3 additions & 2 deletions tasks/install-snmp_exporter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- include_vars: 'snmpexporter.yml'
- name: Include snmp exporter variables
include_vars: 'snmpexporter.yml'

- name: Creating snmp exporter directories
file:
Expand All @@ -19,7 +20,7 @@
group: "{{ prometheus_group }}"
copy: no
creates: "{{ prometheus_install_dir }}/{{ prometheus_snmp_exporter_archive }}"
ignore_errors: "{{ansible_check_mode}}"
ignore_errors: "{{ ansible_check_mode }}"

- name: Copy snmp exporter config
copy:
Expand Down
3 changes: 3 additions & 0 deletions vars/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
_alert_manager_validate_url:
"{% if prometheus_alert_manager_web__external_url is not none %}{{ prometheus_alert_manager_web__external_url }}{% else %}'http://127.0.0.1:9093'{% endif %}"

############################################################
# Auto generated
############################################################
Expand Down

0 comments on commit 931fcde

Please sign in to comment.