blob: 0f27351b0cf9dc72c29b66cc99d51563202de4c1 [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
- name: Start Elasticsearch
service: name=elasticsearch state=started
- name : Wait for Elasticsearch Host to Start
wait_for:
host: "{{ groups.search[0] }}"
port: "{{ elasticsearch_web_port }}"
delay: 10
timeout: 300
- name: Wait for Green Index Status
uri:
url: "http://{{ groups.search[0] }}:{{ elasticsearch_web_port }}/_cat/health"
method: GET
status_code: 200
return_content: yes
register: result
until: result.content.find("green") != -1
retries: 10
delay: 60
- name: Add Elasticsearch templates for topologies
uri:
url: "http://{{ groups.search[0] }}:{{ elasticsearch_web_port }}/_template/template_{{ item.sensor }}"
method: PUT
body: "{{ item.file }} | to_json "
status_code: 200
with_items:
- { sensor: bro, file: "{{ lookup('file','bro_index.template') }}" }
- { sensor: yaf, file: "{{ lookup('file','yaf_index.template') }}" }
- { sensor: snort, file: "{{ lookup('file','snort_index.template') }}" }
- name: Stop Elasticsearch
service: name=elasticsearch state=stopped