forked from ansible-collection/filebeat
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
- name: "Install Filebeat Instance <{{ instance_name }}>"
|
|
hosts: filebeats
|
|
|
|
tasks:
|
|
- name: Install Filebeat
|
|
ansible.builtin.unarchive:
|
|
src: "{{ filebeat_download_url }}"
|
|
dest: "/data/opt/filebeat/{{ instance_name }}"
|
|
remote_src: yes
|
|
extra_opts:
|
|
- --strip-components=1
|
|
|
|
- name: Install Supervisor
|
|
ansible.builtin.pip:
|
|
name: supervisor
|
|
executable: "{{ pip_bin_path }}"
|
|
|
|
- name: Render Filebeat Configure File
|
|
ansible.builtin.template:
|
|
src: filebeat.yml
|
|
dest: "/data/opt/filebeat/{{ instance_name }}/filebeat.yml"
|
|
owner: root
|
|
group: root
|
|
mode: '0640'
|
|
|
|
- name: Render Supervisor Configure File
|
|
ansible.builtin.template:
|
|
src: supervisor.yml
|
|
dest: "/data/opt/filebeat/filebeat_{{ instance_name }}/supervisor.yml"
|
|
owner: root
|
|
group: root
|
|
mode: '0750'
|
|
vars:
|
|
work_path: "/data/opt/filebeat/filebeat_{{ instance_name }}"
|
|
|
|
- name: Render Supervisor SystemV Script
|
|
ansible.builtin.template:
|
|
src: supervisor.sh
|
|
dest: "/etc/init.d/filebeat_{{ instance_name }}"
|
|
owner: root
|
|
group: root
|
|
mode: '0750'
|
|
vars:
|
|
config_file_path: "/data/opt/filebeat/filebeat_{{ instance_name }}/supervisor.yml"
|
|
work_path: "/data/opt/filebeat/filebeat_{{ instance_name }}"
|
|
|
|
- name: Start Filebeat Service
|
|
ansible.builtin.service:
|
|
name: "filebeat_{{ instance_name }}"
|
|
state: restarted
|
|
enabled: true
|
|
|
|
|