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

alloy: Use reload instead of restart on config changes #240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions roles/alloy/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
- name: Check if alloy service is active
ansible.builtin.shell: systemctl is-active alloy
register: alloy_service_status
ignore_errors: true
listen: "Reload alloy"

- name: Restart alloy service if not active
ansible.builtin.service:
name: alloy
state: restarted
when: alloy_service_status.stdout != "active"
listen: "Reload alloy"

- name: Reload alloy service if active
ansible.builtin.service:
name: alloy
state: reloaded
when: alloy_service_status.stdout == "active"
listen: "Reload alloy"

- name: Check alloy is started properly
ansible.builtin.include_tasks: ga-started.yml
listen: "Reload alloy"

- name: Restart alloy
ansible.builtin.systemd:
name: "{{ service_name }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/alloy/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
owner: "{{ service_user }}"
group: "{{ service_group }}"
mode: '0644'
notify: Restart alloy
notify: Reload alloy
become: true

- name: Deploy alloy environment file
Expand Down