Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only daemon reload if we need to #12

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tasks/textfile-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
mode: u=rwx,g=rx,o=rx
when: not item.symlink is defined

- block:
- name: Add textfile collector script
when: node_exporter_textfile_directory != ""
block:
- name: Create node_exporter systemd scripts directory
ansible.builtin.file:
path: "{{ node_exporter_systemd_scripts_dir }}"
Expand All @@ -46,6 +48,7 @@
owner: root
group: root
mode: u=rw,g=r,o=r
register: _unit_file

- name: Add node_exporter textfile systemd timer
ansible.builtin.template:
Expand All @@ -54,12 +57,13 @@
owner: root
group: root
mode: u=rw,g=r,o=r
register: _timer_file

- name: Enable node_exporter textfile systemd timer
ansible.builtin.systemd:
name: node_exporter_{{ item.name }}.timer
daemon_reload: true
daemon_reload: >-
{{ true if _unit_file is changed or _timer_file is changed else false }}
enabled: true
masked: false
state: started
when: node_exporter_textfile_directory != ""