Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Make sure the right beat service gets restarted
Browse files Browse the repository at this point in the history
When running more than one role at once, make sure all of the right notifies
get triggered, not just the one for the last beat role run.
  • Loading branch information
nyetwurk committed Jul 30, 2019
1 parent 4dc1812 commit 9e007ab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# handlers file for beats

- name: restart beat
- name: restart {{ beat }}
service: name={{ beat }} state=restarted enabled=yes
when: start_service and restart_on_change and not beats_started.changed
6 changes: 3 additions & 3 deletions tasks/beats-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#Copy the default file
- name: Copy Default File for Instance
template: src=beat.j2 dest={{instance_default_file}} mode=0644 force=yes owner=root group=root
notify: restart beat
notify: restart {{ beat }}

#Copy templated config file
- name: Copy Configuration File
- name: Copy Configuration File for {{ beat }}
template: src=beat.yml.j2 dest={{conf_file}} mode=0644 force=yes owner=root group=root
notify: restart beat
notify: restart {{ beat }}
4 changes: 2 additions & 2 deletions tasks/beats-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
- name: Debian - Ensure {{beat}} is installed
apt: name={{beat}}{% if beats_version is defined and beats_version != "" %}={{ beats_version }}{% endif %} state=present cache_valid_time=86400
when: use_repository
notify: restart beat
notify: restart {{beat}}

- name: Debian - hold {{beat}} version
command: apt-mark hold {{beat}}
Expand All @@ -54,4 +54,4 @@
- name: Debian - Ensure {{beat}} is installed from downloaded package
apt: deb=/tmp/{{beat}}_{{ beats_version }}_{{os_arch}}.deb
when: not use_repository
notify: restart beat
notify: restart {{beat}}
4 changes: 2 additions & 2 deletions tasks/beats-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- name: RedHat - Ensure {{beat}} is installed
yum: name={{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %} state=present update_cache=yes
when: use_repository
notify: restart beat
notify: restart {{beat}}

- name: RedHat - lock {{beat}} version
shell: yum versionlock add {{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %}
Expand All @@ -28,4 +28,4 @@
- name: RedHat - Install {{beat}} from url
yum: name={% if custom_package_url is defined %}{{ custom_package_url }}{% else %}{{ beats_package_url }}/{{beat}}-{{ beats_version }}-{{ansible_architecture}}.rpm{% endif %} state=present
when: not use_repository
notify: restart beat
notify: restart {{beat}}

0 comments on commit 9e007ab

Please sign in to comment.