diff --git a/roles/prometheus/molecule/default/prepare.yml b/roles/prometheus/molecule/default/prepare.yml new file mode 100644 index 000000000..347673057 --- /dev/null +++ b/roles/prometheus/molecule/default/prepare.yml @@ -0,0 +1,17 @@ +--- +- name: Run local preparation + hosts: localhost + gather_facts: false + tasks: + - name: Create scrapes directory + ansible.builtin.file: + name: "{{ playbook_dir }}/../../prometheus/scrapes" + state: directory + recurse: true + check_mode: false + - name: Create empty scrape config file + ansible.builtin.file: + name: "{{ playbook_dir }}/../../prometheus/scrapes/empty_scrapes.yml" + state: touch + mode: 0664 + check_mode: false diff --git a/roles/prometheus/molecule/default/tests/test_default.py b/roles/prometheus/molecule/default/tests/test_default.py index da6305b69..21b39b900 100644 --- a/roles/prometheus/molecule/default/tests/test_default.py +++ b/roles/prometheus/molecule/default/tests/test_default.py @@ -22,6 +22,7 @@ def AnsibleDefaults(): "/etc/prometheus/consoles", "/etc/prometheus/rules", "/etc/prometheus/file_sd", + "/etc/prometheus/scrapes", "/var/lib/prometheus" ]) def test_directories(host, dirs): @@ -34,6 +35,7 @@ def test_directories(host, dirs): "/etc/prometheus/prometheus.yml", "/etc/prometheus/console_libraries/prom.lib", "/etc/prometheus/consoles/prometheus.html", + "/etc/prometheus/scrapes/empty_scrapes.yml", "/etc/prometheus/web.yml", "/etc/systemd/system/prometheus.service", "/usr/local/bin/prometheus",