fix ansible-lint errors
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
---
|
||||
smartctl_exp_web_listen_address: "localhost:9633"
|
||||
smartctl_exp_args: ""
|
||||
smartctl_exp_version: "0.14.0"
|
||||
smartctl_exp_dir: "/etc/exporters"
|
||||
smartctl_exp_web_config_dir: "/etc/exporters/config"
|
||||
smartctl_exp_interval: "60s"
|
||||
smartctl_exp_rescan: "10m"
|
||||
smartctl_exp_devices: []
|
||||
smartctl_exp_device_exclude: ""
|
||||
smartctl_exp_device_include: ""
|
||||
smartctl_exp_web_telemetry_path: "/metrics"
|
||||
smartctl_exp_log_level: "info"
|
||||
smartctl_exp_log_format: "logfmt"
|
||||
smartctl_exporter_web_listen_address: "localhost:9633"
|
||||
smartctl_exporter_args: ""
|
||||
smartctl_exporter_version: "0.14.0"
|
||||
smartctl_exporter_dir: "/etc/exporters"
|
||||
smartctl_exporter_web_config_dir: "/etc/exporters/config"
|
||||
smartctl_exporter_interval: "60s"
|
||||
smartctl_exporter_rescan: "10m"
|
||||
smartctl_exporter_devices: []
|
||||
smartctl_exporter_device_exclude: ""
|
||||
smartctl_exporter_device_include: ""
|
||||
smartctl_exporter_web_telemetry_path: "/metrics"
|
||||
smartctl_exporter_log_level: "info"
|
||||
smartctl_exporter_log_format: "logfmt"
|
||||
|
||||
@@ -10,8 +10,8 @@ galaxy_info:
|
||||
|
||||
platforms:
|
||||
- name: "Ubuntu"
|
||||
versions: [ "focal", "jammy", "noble" ]
|
||||
versions: ["focal", "jammy", "noble"]
|
||||
|
||||
galaxy_tags: [ ]
|
||||
galaxy_tags: []
|
||||
|
||||
dependencies: []
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
- name: Converge
|
||||
hosts: all
|
||||
roles:
|
||||
- role: genlab.smartctl_exporter
|
||||
smartctl_exp_dir: "/etc/exporters"
|
||||
- role: genlab.common.smartctl_exporter
|
||||
smartctl_exporter_dir: "/etc/exporters"
|
||||
smartctl_exp_config_dir: "/etc/exporters/config"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
- name: "Include default vars"
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
|
||||
extensions: [ 'yml' ]
|
||||
extensions: ['yml']
|
||||
|
||||
- name: "Check if smartctl_exporter is installed"
|
||||
changed_when: false
|
||||
@@ -17,21 +17,21 @@
|
||||
|
||||
- name: "Check smartctl_exporter version"
|
||||
ansible.builtin.assert:
|
||||
that: "smartctl_exporter_installed_version.stderr is regex('{{ smartctl_exp_version }}')"
|
||||
success_msg: "smartctl_exporter version {{ smartctl_exp_version }} is installed and working"
|
||||
fail_msg: "smartctl_exporter version {{ smartctl_exp_version }} is not installed or not working correctly"
|
||||
that: "smartctl_exporter_installed_version.stderr is regex('{{ smartctl_exporter_version }}')"
|
||||
success_msg: "smartctl_exporter version {{ smartctl_exporter_version }} is installed and working"
|
||||
fail_msg: "smartctl_exporter version {{ smartctl_exporter_version }} is not installed or not working correctly"
|
||||
|
||||
# kics-scan ignore-block
|
||||
- name: "Check if /metrics endpoint is reachable"
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ smartctl_exp_web_listen_address }}/metrics"
|
||||
url: "http://{{ smartctl_exporter_web_listen_address }}/metrics"
|
||||
return_content: true
|
||||
status_code: 200
|
||||
timeout: 5
|
||||
register: metrics_check
|
||||
register: smartctl_exporter_metrics_check
|
||||
|
||||
- name: "Fail if /metrics doesn't contain smartctl_exporter_build_info line"
|
||||
ansible.builtin.assert:
|
||||
that: "'smartctl_exporter_build_info' in metrics_check.content"
|
||||
that: "'smartctl_exporter_build_info' in smartctl_exporter_metrics_check.content"
|
||||
fail_msg: "smartctl_exporter /metrics endpoint doesn't contain smartctl_exporter_build_info line!"
|
||||
success_msg: "smartctl_exporter /metrics endpoint contains smartctl_exporter_build_info line!"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
when: smartctl_exp_source_web_config_dir is defined and smartctl_exp_source_web_config_dir | length > 0
|
||||
ansible.builtin.template:
|
||||
src: "{{ smartctl_exp_source_web_config_dir }}/web_smartctl.conf"
|
||||
dest: "{{ smartctl_exp_web_config_dir }}/web_smartctl.conf"
|
||||
dest: "{{ smartctl_exporter_web_config_dir }}/web_smartctl.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0640'
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
- name: "Assert version correctness"
|
||||
ansible.builtin.assert:
|
||||
that: "smartctl_exporter_ver.stderr is regex('{{ smartctl_exp_version }}')"
|
||||
success_msg: "smartctl_exporter version {{ smartctl_exp_version }} is installed and working"
|
||||
fail_msg: "smartctl_exporter version {{ smartctl_exp_version }} is not installed or not working correctly"
|
||||
that: "smartctl_exporter_ver.stderr is regex('{{ smartctl_exporter_version }}')"
|
||||
success_msg: "smartctl_exporter version {{ smartctl_exporter_version }} is installed and working"
|
||||
fail_msg: "smartctl_exporter version {{ smartctl_exporter_version }} is not installed or not working correctly"
|
||||
|
||||
rescue:
|
||||
- name: "Create smartctl_exporter directories"
|
||||
@@ -22,20 +22,20 @@
|
||||
group: root
|
||||
mode: "0755"
|
||||
with_items:
|
||||
- "{{ smartctl_exp_dir }}"
|
||||
- "{{ smartctl_exporter_dir }}"
|
||||
- "{{ smartctl_exp_config_dir }}"
|
||||
|
||||
- name: "Unarchive smartctl_exporter tar file"
|
||||
notify: "(Re)start and enable smartctl_exporter"
|
||||
ansible.builtin.unarchive:
|
||||
src: "https://github.com/prometheus-community/smartctl_exporter/releases/\
|
||||
download/v{{ smartctl_exp_version }}/smartctl_exporter-{{ smartctl_exp_version }}.linux-amd64.tar.gz"
|
||||
dest: "{{ smartctl_exp_dir }}"
|
||||
download/v{{ smartctl_exporter_version }}/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64.tar.gz"
|
||||
dest: "{{ smartctl_exporter_dir }}"
|
||||
remote_src: true
|
||||
|
||||
- name: "Move smartctl_exporter binary"
|
||||
ansible.builtin.copy:
|
||||
src: "{{ smartctl_exp_dir }}/smartctl_exporter-{{ smartctl_exp_version }}.linux-amd64/smartctl_exporter"
|
||||
src: "{{ smartctl_exporter_dir }}/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64/smartctl_exporter"
|
||||
dest: "/usr/local/bin/smartctl_exporter"
|
||||
mode: "0755"
|
||||
owner: root
|
||||
|
||||
@@ -10,24 +10,24 @@ Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/usr/local/bin/smartctl_exporter \
|
||||
--web.listen-address={{ smartctl_exp_web_listen_address }} \
|
||||
--smartctl.interval={{ smartctl_exp_interval }} \
|
||||
--smartctl.rescan={{ smartctl_exp_rescan }} \
|
||||
{% if smartctl_exp_devices is defined and smartctl_exp_devices | length > 0 %}
|
||||
{% for device in smartctl_exp_devices %}
|
||||
--web.listen-address={{ smartctl_exporter_web_listen_address }} \
|
||||
--smartctl.interval={{ smartctl_exporter_interval }} \
|
||||
--smartctl.rescan={{ smartctl_exporter_rescan }} \
|
||||
{% if smartctl_exporter_devices is defined and smartctl_exporter_devices | length > 0 %}
|
||||
{% for device in smartctl_exporter_devices %}
|
||||
--smartctl.device={{ device }} \
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
--smartctl.device-exclude={{ smartctl_exp_device_exclude }} \
|
||||
--smartctl.device-include={{ smartctl_exp_device_include }} \
|
||||
--web.telemetry-path={{ smartctl_exp_web_telemetry_path }} \
|
||||
--log.level={{ smartctl_exp_log_level }} \
|
||||
--log.format={{ smartctl_exp_log_format }} \
|
||||
{% if smartctl_exp_args is defined and smartctl_exp_args | length > 0 %}
|
||||
{{ smartctl_exp_args }} \
|
||||
--smartctl.device-exclude={{ smartctl_exporter_device_exclude }} \
|
||||
--smartctl.device-include={{ smartctl_exporter_device_include }} \
|
||||
--web.telemetry-path={{ smartctl_exporter_web_telemetry_path }} \
|
||||
--log.level={{ smartctl_exporter_log_level }} \
|
||||
--log.format={{ smartctl_exporter_log_format }} \
|
||||
{% if smartctl_exporter_args is defined and smartctl_exporter_args | length > 0 %}
|
||||
{{ smartctl_exporter_args }} \
|
||||
{% endif %}
|
||||
{% if smartctl_exp_source_web_config_dir is defined and smartctl_exp_source_web_config_dir | length > 0 %} \
|
||||
--web.config.file={{ smartctl_exp_web_config_dir }}/web_smartctl.conf
|
||||
--web.config.file={{ smartctl_exporter_web_config_dir }}/web_smartctl.conf
|
||||
{% endif %}
|
||||
|
||||
SyslogIdentifier=smartctl_exporter
|
||||
|
||||
Reference in New Issue
Block a user