openstack-ansible-ops/graylog/graylog-forward-logs.yml
Dmitriy Rabotyagov 6ec721bf49 Update graylog-forwarder to use py3
Change-Id: I6ccd695d6aa61c1ef7f21f15c8ec89a2223381ac
2020-10-01 12:39:50 +00:00

45 lines
1.6 KiB
YAML

---
- hosts: all:!log_hosts
gather_facts: no
vars:
graylog_forwarder_system_packages:
- python3-systemd
- python3-pip
graylog_forwarder_pip_packages:
- gelfclient==0.0.7
- journal2gelf==2.0.0
tasks:
#- name: Gather variables for each operating system
# include_vars: "{{ item }}"
# with_first_found:
# - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
# - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
# - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
# - "{{ ansible_distribution | lower }}.yml"
# - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
# - "{{ ansible_os_family | lower }}.yml"
# tags:
# - always
- name: Install graylog forwarder package requirements
package:
name: "{{ graylog_forwarder_system_packages }}"
state: present
# Graylog wasn't build in repo, and requires running "isolated"
- name: Install graylog forwarder requirements
pip:
name: "{{ graylog_forwarder_pip_packages }}"
state: present
- name: Install the log forwarder service.
include_role:
name: systemd_service
with_items: "{{ graylog_targets }}"
loop_control:
loop_var: graylog_target
vars:
systemd_services:
- service_name: gelf-forwarder
state: started
execstarts:
- "/usr/local/bin/journal2gelf {{ graylog_target }}"