Zack Williams | 275e48b | 2017-03-24 12:16:00 -0700 | [diff] [blame] | 1 | --- |
| 2 | # elasticstack/tasks/main.yml |
| 3 | |
| 4 | - name: Add ElasticStack apt-key |
| 5 | apt_key: |
| 6 | data: "{{ lookup('file','elastic.asc') }}" |
| 7 | state: present |
| 8 | |
| 9 | - name: Add ElasticStack repositories |
| 10 | apt_repository: |
| 11 | repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main" |
| 12 | |
| 13 | - name: Install ElasticStack |
| 14 | apt: |
| 15 | name: "{{ item }}" |
| 16 | update_cache: yes |
| 17 | cache_valid_time: 3600 |
| 18 | with_items: |
| 19 | - elasticsearch |
| 20 | - kibana |
| 21 | - logstash |
| 22 | |
| 23 | - name: Configure Kibana for HTTP proxy |
| 24 | lineinfile: |
| 25 | dest: /etc/kibana/kibana.yml |
| 26 | regexp: '^server.basePath:' |
| 27 | line: 'server.basePath: "/kibana"' |
| 28 | insertafter: '^#server.basePath*' |
| 29 | notify: |
| 30 | - restart kibana |
| 31 | |
| 32 | - name: Configure Logstash inputs and outputs |
| 33 | copy: |
| 34 | src: "{{ item }}" |
| 35 | dest: "/etc/logstash/conf.d/{{ item }}" |
| 36 | owner: root |
| 37 | group: root |
| 38 | mode: "0644" |
| 39 | with_items: |
| 40 | - 10-udp-input.conf |
| 41 | - 11-log4j-input.conf |
| 42 | - 12-syslog-input.conf |
| 43 | - 30-elasticsearch-output.conf |
| 44 | notify: |
| 45 | - restart logstash |
| 46 | |
| 47 | - name: Start ElasticStack |
| 48 | service: |
| 49 | name: "{{ item }}" |
| 50 | enabled: yes |
| 51 | state: started |
| 52 | with_items: |
| 53 | - logstash |
| 54 | - elasticsearch |
| 55 | - kibana |
| 56 | |