bc2937d9c9
Elasticsearch can be used as a smart load balancer for all traffic which will remove the requirement for a VIP and move the cluster to a mesh topology. All of the Kibana nodes will now run elasticsearch as cordonator. * Kibana will now connect to elasticsearch on localhost. * All of the beats have been setup to use use the new mesh topology. * jvm memory management has been updated to reflect the additional services. More on node assigments can be found here: * https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-node.html#modules-node * The readme has been updated to reflect these changes. Change-Id: I769e0251072f5dbde56fcce7753236d37d5c3b19 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
160 lines
4.1 KiB
YAML
160 lines
4.1 KiB
YAML
---
|
|
- name: Install Logstash
|
|
hosts: elastic-logstash
|
|
become: true
|
|
vars_files:
|
|
- vars/variables.yml
|
|
|
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
|
|
|
pre_tasks:
|
|
- include_tasks: common_task_data_node_hosts.yml
|
|
|
|
tasks:
|
|
- name: Set quarter memory fact
|
|
set_fact:
|
|
q_mem: "{{ (ansible_memtotal_mb | int) // 4 }}"
|
|
tags:
|
|
- always
|
|
|
|
- name: Set logstash facts
|
|
set_fact:
|
|
elastic_heap_size: "{{ ((q_mem | int) > 30720) | ternary(30720, q_mem) }}"
|
|
tags:
|
|
- always
|
|
|
|
- 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 elasticsearch output
|
|
template:
|
|
src: templates/99-elasticsearch-output.conf.j2
|
|
dest: /etc/logstash/conf.d/99-elasticsearch-output.conf
|
|
|
|
- name: Drop elasticsearch conf file
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
with_items:
|
|
- src: templates/jvm.options.j2
|
|
dest: /etc/logstash/jvm.options
|
|
tags:
|
|
- config
|
|
|
|
- name: Create patterns directory
|
|
file:
|
|
name: "/opt/logstash/patterns"
|
|
owner: "logstash"
|
|
group: "logstash"
|
|
state: directory
|
|
tags:
|
|
- logstash-patterns
|
|
|
|
- name: Logstash Extra Patterns
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "/opt/logstash/patterns/{{ item }}"
|
|
owner: "logstash"
|
|
group: "logstash"
|
|
with_items:
|
|
- extras
|
|
when:
|
|
- logstash_deploy_filters
|
|
tags:
|
|
- logstash-filters
|
|
- config
|
|
|
|
- name: Deploy Logstash configuration files
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "/etc/logstash/conf.d/{{ item }}"
|
|
with_items:
|
|
- 02-general.conf
|
|
- 03-nova.conf
|
|
- 04-neutron.conf
|
|
- 05-glance.conf
|
|
- 06-cinder.conf
|
|
- 07-libvirt.conf
|
|
- 08-apache.conf
|
|
- 09-heat.conf
|
|
- 10-mysql.conf
|
|
- 11-auth.conf
|
|
- 12-logstash.conf
|
|
- 13-swift.conf
|
|
- 14-keystone.conf
|
|
- 16-elasticsearch.conf
|
|
- 17-rabbitmq.conf
|
|
- 18-ceph.conf
|
|
- 19-nginx.conf
|
|
- 20-magnum.conf
|
|
- 21-octavia.conf
|
|
- 98-traceback.conf
|
|
when:
|
|
- logstash_deploy_filters
|
|
tags:
|
|
- logstash-filters
|
|
- config
|
|
|
|
- name: Ensure logstash ownership
|
|
file:
|
|
path: /var/lib/logstash
|
|
owner: logstash
|
|
group: logstash
|
|
recurse: true
|
|
|
|
- name: Enable and restart logstash
|
|
systemd:
|
|
name: "logstash"
|
|
enabled: true
|
|
state: restarted
|