forked from ISTI-ansible-roles/ansible-roles
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
---
|
|
- name: Install the rsyslog ppa on ubuntu precise or later
|
|
apt_repository: repo='{{ rsyslog_ppa }}'
|
|
when:
|
|
- is_ubuntu
|
|
- rsyslog_install_newer_package
|
|
register: rsyslog_ubuntu_repo
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Install the rsyslog repo key on debian wheezy
|
|
apt_key: keyserver=keys.gnupg.net id=AEF0CF8E state=present
|
|
when:
|
|
- is_debian7
|
|
- rsyslog_install_newer_package
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Install the rsyslog repository on debian wheezy
|
|
copy: content="{{ rsyslog_debian_repo }}\n" dest=/etc/apt/sources.list.d/adiscon-rsyslog.list
|
|
register: rsyslog_debian_repo
|
|
when:
|
|
- is_debian7
|
|
- rsyslog_install_newer_package
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Update apt cache
|
|
apt: update_cache=yes
|
|
when: (rsyslog_ubuntu_repo|changed) or (rsyslog_debian_repo|changed)
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Add the syslog user to the adm group so it can read all the log files
|
|
user: name=syslog groups=adm
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Upgrade rsyslog and install the elasticsearch module
|
|
apt: pkg={{ item }} state={{ rsyslog_pkg_status }}
|
|
with_items:
|
|
- rsyslog
|
|
- rsyslog-elasticsearch
|
|
tags:
|
|
- rsyslog
|
|
- logstash
|
|
|
|
- name: Add a rsyslog configuration to send logfiles data to a logstash collector or directly to elasticsearch
|
|
template: src=rsyslog-logstash.conf.j2 dest=/etc/rsyslog.d/90-rsyslog-logstash.conf owner=root group=root mode=0444
|
|
when: rsyslog_install_newer_package
|
|
notify:
|
|
Restart rsyslog
|
|
tags:
|
|
- logstash
|
|
- rsyslog
|
|
|
|
- name: Add a rsyslog configuration to send logfiles data to a logstash collector when using the original and old rsyslog package
|
|
template: src=old-rsyslog-logstash.conf.j2 dest=/etc/rsyslog.d/90-rsyslog-logstash.conf owner=root group=root mode=0444
|
|
when: not rsyslog_install_newer_package
|
|
notify:
|
|
Restart rsyslog
|
|
tags:
|
|
- logstash
|
|
- rsyslog
|
|
|