
* Added options for the rollback plan so that if a rollback is executed all beat packages will be removed. * additional updates to streamline elk and fix container bindmounts, the use of group information for metric and heartbeat information. * Readme information has been fixed Change-Id: Icd070259db5b19d289d10033b1f055125f56e18c Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
---
|
|
- name: Install Logstash
|
|
hosts: elastic-logstash
|
|
become: true
|
|
vars_files:
|
|
- vars/variables.yml
|
|
tasks:
|
|
- include_tasks: common_task_install_elk_repo.yml
|
|
|
|
- name: Configure systcl vm.max_map_count=262144 on container hosts
|
|
sysctl:
|
|
name: "vm.max_map_count"
|
|
value: "262144"
|
|
state: "present"
|
|
reload: "yes"
|
|
delegate_to: "{{ physical_host }}"
|
|
tags:
|
|
- sysctl
|
|
|
|
- name: Ensure mount directories exists
|
|
file:
|
|
path: "/openstack/{{ inventory_hostname }}/logstash"
|
|
state: "directory"
|
|
delegate_to: "{{ physical_host }}"
|
|
|
|
- name: logstash datapath bind mount
|
|
lxc_container:
|
|
name: "{{ inventory_hostname }}"
|
|
container_command: |
|
|
[[ ! -d "/var/lib/logstash" ]] && mkdir -p "/var/lib/logstash"
|
|
container_config:
|
|
- "lxc.mount.entry=/openstack/{{ inventory_hostname }}/logstash var/lib/logstash none bind 0 0"
|
|
delegate_to: "{{ physical_host }}"
|
|
when:
|
|
- physical_host != inventory_hostname
|
|
- container_tech | default('lxc') == 'lxc'
|
|
|
|
- name: Ensure Java is installed
|
|
apt:
|
|
name: openjdk-8-jre
|
|
state: present
|
|
install_recommends: yes
|
|
update_cache: yes
|
|
|
|
- name: Ensure Logstash is installed.
|
|
apt:
|
|
name: logstash
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: Drop Logstash conf for beats input
|
|
template:
|
|
src: templates/02-beats-input.conf.j2
|
|
dest: /etc/logstash/conf.d/02-beats-input.conf
|
|
|
|
- name: Drop Logstash conf for beats input
|
|
template:
|
|
src: templates/10-syslog-filter.conf.j2
|
|
dest: /etc/logstash/conf.d/10-syslog-filter.conf
|
|
|
|
- name: Drop Logstash conf for beats output
|
|
template:
|
|
src: templates/30-elasticsearch-output.conf.j2
|
|
dest: /etc/logstash/conf.d/30-elasticsearch-output.conf
|
|
|
|
- name: Ensure logstash ownership
|
|
file:
|
|
path: /var/lib/logstash
|
|
owner: logstash
|
|
group: logstash
|
|
recurse: true
|
|
|
|
- name: Load logstash config
|
|
command: "/usr/share/logstash/bin/logstash -t --path.settings /etc/logstash"
|
|
register: conf_success
|
|
become: yes
|
|
become_user: logstash
|
|
|
|
- name: Print config output
|
|
debug: var=conf_success
|
|
|
|
- name: Enable and restart logstash
|
|
systemd:
|
|
name: "logstash"
|
|
enabled: true
|
|
state: restarted
|