Skip to content

Commit

Permalink
Use "wait_for" instead of "sleep" in ansible roles (closes #125)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldemirenes committed Sep 6, 2017
1 parent 2e68384 commit 6386c9f
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions provisioning/roles/sp_mini_7_configure/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
name: elasticsearch
state: started

- name: Sleep 15 second
pause:
seconds: 15
- name: Wait 300 seconds for Elasticsearch port 9200 to become open on the host, don't start checking for 10 seconds
wait_for:
port: 9200
delay: 10

- name: curl put good-mapping.json
shell: "curl -XPUT 'http://localhost:9200/good' -d @{{es_dir}}/good-mapping.json"
Expand All @@ -23,15 +24,10 @@
name: iglu_server_0.2.0
state: started

- name: Sleep 30 second
pause:
seconds: 30

- name: Starting Kibana
become: yes
service:
name: kibana4_init
state: started
- name: Wait Iglu Server port 8081 to become open on the host
wait_for:
port: 8081
delay: 5

- name: Starting Snowplow-Mini Control API
become: yes
Expand All @@ -50,18 +46,21 @@
service:
name: snowplow_stream_enrich
state: started
register: StreamEnrichStarted

- name: Starting Snowplow Elastic Search Sink Good
become: yes
service:
name: snowplow_elasticsearch_loader_good
state: started
register: ESLoaderGoodStarted

- name: Starting Snowplow Elastic Search Sink Bad
become: yes
service:
name: snowplow_elasticsearch_loader_bad
state: started
register: ESLoaderBadStarted

- name: Starting Nginx
become: yes
Expand All @@ -87,9 +86,32 @@
name: nsqlookupd_init
state: started

- name: Sleep 30 second
- name: Starting Kibana
become: yes
service:
name: kibana4_init
state: started

- name: Wait the other services to start
wait_for:
port: "{{item}}"
delay: 1
with_items:
- 10000
- 8080
- 80
- 3000
- 5601

- name: Wait until Stream Enrich and ES Loader are started
pause:
seconds: 30
seconds: 10
until:
(StreamEnrichStarted|changed) and
(ESLoaderGoodStarted) and
(ESLoaderBadStarted)
retries: 5
delay: 10

- name: add "good" index pattern to Kibana
shell: >
Expand Down

0 comments on commit 6386c9f

Please sign in to comment.