# vim: ft=ansible
---
- hosts: elasticsearch
  tags:
    - elasticsearch
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'leifmadsen.elasticsearch' }

- hosts: logstash
  tags:
    - logstash
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'leifmadsen.logstash' }

- hosts: kibana
  tags:
    - kibana
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'geerlingguy.nginx' }
    - { role: 'leifmadsen.kibana-4' }

  post_tasks:
    - name: Validate SELinux is enabled
      selinux:
        policy: targeted
        state: enforcing

    - name: SELinux -- Enable httpd_can_network_connect
      seboolean:
        name: httpd_can_network_connect
        state: yes
        persistent: yes

# vim: ft=ansible
---
- hosts: elasticsearch
  tags:
    - elasticsearch
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'leifmadsen.elasticsearch' }

- hosts: logstash
  tags:
    - logstash
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'geerlingguy.java' }
    - { role: 'leifmadsen.logstash' }

- hosts: kibana
  tags:
    - kibana
    - elk

  vars_files:
    - "{{ inventory_dir  }}/../vars/main.yml"

  roles:
    - { role: 'geerlingguy.repo-epel' }
    - { role: 'geerlingguy.nginx' }
    - { role: 'leifmadsen.kibana-4' }

  post_tasks:
    - name: Validate SELinux is enabled
      selinux:
        policy: targeted
        state: enforcing

    - name: SELinux -- Enable httpd_can_network_connect
      seboolean:
        name: httpd_can_network_connect
        state: yes
        persistent: yes

Add java to logstash deployment node
Add java to logstash deployment node
