Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | 275e48b | 2017-03-24 12:16:00 -0700 | [diff] [blame] | 17 | --- |
| 18 | # elasticstack/tasks/main.yml |
| 19 | |
| 20 | - name: Add ElasticStack apt-key |
| 21 | apt_key: |
| 22 | data: "{{ lookup('file','elastic.asc') }}" |
| 23 | state: present |
| 24 | |
| 25 | - name: Add ElasticStack repositories |
| 26 | apt_repository: |
| 27 | repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main" |
| 28 | |
| 29 | - name: Install ElasticStack |
| 30 | apt: |
| 31 | name: "{{ item }}" |
| 32 | update_cache: yes |
| 33 | cache_valid_time: 3600 |
| 34 | with_items: |
| 35 | - elasticsearch |
| 36 | - kibana |
| 37 | - logstash |
| 38 | |
| 39 | - name: Configure Kibana for HTTP proxy |
| 40 | lineinfile: |
| 41 | dest: /etc/kibana/kibana.yml |
| 42 | regexp: '^server.basePath:' |
| 43 | line: 'server.basePath: "/kibana"' |
| 44 | insertafter: '^#server.basePath*' |
| 45 | notify: |
| 46 | - restart kibana |
| 47 | |
| 48 | - name: Configure Logstash inputs and outputs |
| 49 | copy: |
| 50 | src: "{{ item }}" |
| 51 | dest: "/etc/logstash/conf.d/{{ item }}" |
| 52 | owner: root |
| 53 | group: root |
| 54 | mode: "0644" |
| 55 | with_items: |
| 56 | - 10-udp-input.conf |
| 57 | - 11-log4j-input.conf |
| 58 | - 12-syslog-input.conf |
| 59 | - 30-elasticsearch-output.conf |
| 60 | notify: |
| 61 | - restart logstash |
| 62 | |
| 63 | - name: Start ElasticStack |
| 64 | service: |
| 65 | name: "{{ item }}" |
| 66 | enabled: yes |
| 67 | state: started |
| 68 | with_items: |
| 69 | - logstash |
| 70 | - elasticsearch |
| 71 | - kibana |
| 72 | |