Skip to content

sansible/logstash

Repository files navigation

Logstash

Master: Build Status
Develop: Build Status

This roles installs Logstash for the ELK stack.

For more information on Logstash please visit elastic logstash.

Installation and Dependencies

This role will install sansible.users_and_groups for managing logstash user and sansible.java for installing java.

To install run ansible-galaxy install sansible.logstash or add this to your roles.yml

- name: sansible.logstash
  version: v2.1.x

and run ansible-galaxy install -p ./roles -r roles.yml

Tags

This role uses two tags: build and configure

  • build - Installs Logstash and all it's dependencies.
  • configure - Configure and ensures that the Logstash service is running.

Examples

To install:

- name: Elk Logstash
  hosts: "{{ hosts }}"

  roles:
    - role: sansible.logstash

To install 5.* version:

- name: Elk Logstash
  hosts: "{{ hosts }}"

  roles:
    - role: sansible.logstash
      sansible_logstash_family: 5.x
      sansible_logstash_version: 1:5.4.*

To install 6.* version:

- name: Elk Logstash
  hosts: "{{ hosts }}"

  roles:
    - role: sansible.logstash
      sansible_logstash_family: 6.x
      sansible_logstash_version: 1:6.6.*

With your own config files:

- name: Elk Logstash
  hosts: "{{ hosts }}"

  roles:
    - role: sansible.logstash
      sansible_logstash_default_config: no

  tasks:
    - name: Configure logstash
      become: yes
      template:
        src: "{{ item }}.j2"
        dest: "/etc/logstash/conf.d/{{ item }}"
      with_items:
        - templates/01-inputs.conf
        - templates/10-filters.conf
        - templates/90-outputs.conf
      notify:
        - restart logstash