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

Fix issue with beat variable in restart beat handler name #52

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
# handlers file for beats

- name: restart {{ beat }}
service: name={{ beat }} state=restarted enabled=yes
- name: restart the service
service:
name: "{{ beat_product }}"
state: restarted
enabled: true
when: start_service and restart_on_change and not beats_started.changed
4 changes: 2 additions & 2 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 the service

#Copy templated config 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 the service
6 changes: 3 additions & 3 deletions tasks/beats-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apt: name=apt-transport-https state=present cache_valid_time=86400
when: use_repository
register: beat_install
notify: restart {{beat}}
notify: restart the service

- name: Debian - Ensure python-urllib3, python-openssl, python-pyasn1 & python-pip are installed
apt:
Expand Down 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 the service

- 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 the service
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 the service

- 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 the service
4 changes: 2 additions & 2 deletions tasks/beats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
include: beats-config.yml

# Make sure the service is started, and restart if necessary
- name: Start {{ beat }} service
service: name={{ beat }} state=started enabled=yes
- name: Start {{ beat_product }} service
service: name={{ beat_product }} state=started enabled=yes
when: start_service
register: beats_started
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
- name: check-parameters
include: beats-param-check.yml

- set_fact:
beat_product: "{{ beat }}"

- name: os-specific vars
include_vars: "{{ansible_os_family}}.yml"

- include: beats.yml

- name: Force all notified handlers to run at this point, not waiting for normal sync points
meta: flush_handlers