-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.yml
53 lines (45 loc) · 1.19 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
- name: "Remove {{ beat_name }} data directory"
file:
path: '{{ beat_data_path }}'
state: absent
- name: "Remove {{ beat_name }} logs directory"
file:
path: '{{ beat_logs_path }}'
state: absent
- name: "Pre-run setup for {{ beat_name }}"
include_tasks: '{{ pre_run_item }}'
with_first_found:
- files:
- 'tasks/{{ beat_name }}/pre-run.yml'
skip: true
loop_control:
loop_var: pre_run_item
- name: Replace configuration file with template
template:
src: '{{ beat_name }}.yml.j2'
dest: '{{ beat_cfg }}'
mode: 0600
- name: 'Start {{ beat_service_name }} service'
command: './{{ beat_name }}'
args:
chdir: '{{ beat_home_path }}'
register: async_beat_cmd
async: 60
poll: 0
- name: Sleep for 3 seconds and continue
wait_for: timeout=3
delegate_to: localhost
- name: "Post-run setup for {{ beat_name }}"
include_tasks: '{{ post_run_item }}'
with_first_found:
- files:
- 'tasks/{{ beat_name }}/post-run.yml'
skip: true
loop_control:
loop_var: post_run_item
- name: 'Wait for {{ beat_service_name }} to produce output.json'
wait_for:
path: '{{ beat_output_file }}'
search_regex: '"version"'
timeout: 20