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

Make sure the right beat service gets restarted #34

Merged
merged 1 commit into from
Aug 30, 2019
Merged
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
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}}
8 changes: 4 additions & 4 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 {{beat}}

- name: Debian - Ensure python-urllib3, python-openssl, python-pyasn1 & python-pip are installed
apt:
Expand All @@ -19,7 +19,7 @@
when: use_repository and ansible_distribution_release == "trusty"

- name: Debian - Add Beats repository key
apt_key:
apt_key:
url: "{{ repo_key }}"
state: present
when: use_repository
Expand All @@ -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}}
2 changes: 1 addition & 1 deletion 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 beats service
- name: Start {{ beat }} service
service: name={{ beat }} state=started enabled=yes
when: start_service
register: beats_started