Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nkakouros committed Sep 4, 2022
1 parent 25a6560 commit 9726357
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tasks/core/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
loop: "{{ beats_setup_template_field_overrides }}"
loop_control:
loop_var: _beats__field_setting
when: ansible_os_family != 'Windows'
# TODO there is no win_blockinfile module, find a workaround for windows
9 changes: 8 additions & 1 deletion tasks/core/install/Debian-winlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
_winlogbeat_url:
# TODO Winlogbeat download url does not support wildcards for minor/patch versions
"https://artifacts.elastic.co/downloads/beats/winlogbeat/winlogbeat-{{
beats_major_version }}.{{ beats_minor_version }}.0-windows-x86_64.zip"
beats_major_version }}.{{ beats_minor_version }}.{{
beats_patch_version }}-windows-x86_64.zip"

- name: "{{ beats_flavor }}: Download winlogbeat"
unarchive:
Expand All @@ -68,4 +69,10 @@
dest: "{{ beats_path_home }}"
mode: 0o644
remote_src: true

- name: Copy fields.yml next to config file
copy:
src: "{{ beats_path_home }}/fields.yml"
dest: "{{ beats_path_config }}"
remote_src: true
when: beats_flavor == 'winlogbeat'
10 changes: 10 additions & 0 deletions tasks/core/install/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@
arguments: /quiet
when: beats_flavor == 'packetbeat'

- name: "{{ beats_flavor }}: Stop windows service"
win_service:
name: "{{ beats_flavor }}"
state: stopped

- win_file:
path: "C:\\ProgramData\\chocolatey\\lib\\{{ beats_flavor }}"
state: absent

- name: "{{ beats_flavor }}: Install beat on Windows"
win_chocolatey:
name: "{{ beats_flavor }}"
version: "{{ beats_major_version }}.{{ beats_minor_version }}{{
'.' + beats_patch_version | string if beats_minor_version != '*' }}"
state: latest
force: true

- name: "{{ beats_flavor }}: Create config dir on Windows"
win_file:
Expand Down
3 changes: 2 additions & 1 deletion tasks/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
loop_var: _beats__file
vars:
files:
- "{{ role_path }}/vars/packages/{{ ansible_distribution_release }}.yml"
- "{{ role_path }}/vars/packages/{{ ansible_distribution_release | d('') }}.yml"
- "{{ role_path }}/vars/packages/{{ ansible_os_family }}.yml"
- "{{ role_path }}/vars/main.yml" # fallback
# }}}
# Paths {{{
- name: "{{ beats_flavor }}: Load default paths"
Expand Down
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

_beats_packages: {}

0 comments on commit 9726357

Please sign in to comment.