2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Install the rsyslog ppa on ubuntu precise or later
|
2016-11-07 14:11:50 +01:00
|
|
|
apt_repository: repo='{{ rsyslog_ppa }}' update_cache=yes
|
2015-05-28 11:32:57 +02:00
|
|
|
when:
|
|
|
|
- is_ubuntu
|
2016-11-07 14:11:50 +01:00
|
|
|
- rsyslog_repo_install
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
|
|
|
|
|
|
|
- name: Remove the rsyslog ppa on ubuntu precise or later
|
|
|
|
apt_repository: repo='{{ rsyslog_ppa }}' update_cache=yes state=absent
|
|
|
|
when:
|
|
|
|
- is_ubuntu
|
|
|
|
- not rsyslog_repo_install
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- name: Install the rsyslog repo key on debian wheezy
|
|
|
|
apt_key: keyserver=keys.gnupg.net id=AEF0CF8E state=present
|
|
|
|
when:
|
|
|
|
- is_debian7
|
2016-11-07 14:11:50 +01:00
|
|
|
- rsyslog_repo_install
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- name: Install the rsyslog repository on debian wheezy
|
2016-11-07 14:11:50 +01:00
|
|
|
apt_repository: repo="{{ rsyslog_debian_repo }}" state=present update_cache=yes
|
2015-05-28 11:32:57 +02:00
|
|
|
when:
|
|
|
|
- is_debian7
|
2016-11-07 14:11:50 +01:00
|
|
|
- rsyslog_repo_install
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2016-11-07 14:11:50 +01:00
|
|
|
- name: Remove the rsyslog repository on debian wheezy
|
|
|
|
apt_repository: repo="{{ rsyslog_debian_repo }}" state=absent update_cache=yes
|
|
|
|
when:
|
|
|
|
- is_debian7
|
|
|
|
- not rsyslog_repo_install
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- name: Add the syslog user to the adm group so it can read all the log files
|
|
|
|
user: name=syslog groups=adm
|
2016-11-07 14:11:50 +01:00
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- name: Upgrade rsyslog and install the elasticsearch module
|
2016-11-07 14:11:50 +01:00
|
|
|
apt: pkg={{ item }} state={{ rsyslog_pkg_status }} update_cache=yes cache_valid_time=1800
|
2015-05-28 11:32:57 +02:00
|
|
|
with_items:
|
|
|
|
- rsyslog
|
|
|
|
- rsyslog-elasticsearch
|
2016-11-07 14:11:50 +01:00
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- 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
|
2016-11-07 14:11:50 +01:00
|
|
|
when:
|
|
|
|
- rsyslog_repo_install
|
|
|
|
- rsyslog_send_to_elasticsearch
|
|
|
|
notify: Restart rsyslog
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2016-11-07 14:11:50 +01:00
|
|
|
- name: Remove the rsyslog configuration to send logfiles data to a logstash collector or directly to elasticsearch
|
|
|
|
file: dest=/etc/rsyslog.d/90-rsyslog-logstash.conf state=absent
|
|
|
|
when: not rsyslog_send_to_elasticsearch
|
|
|
|
notify: Restart rsyslog
|
|
|
|
tags: [ 'rsyslog', 'logstash' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|