-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstop.yaml
63 lines (59 loc) · 2.36 KB
/
stop.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: setup
hosts: all
vars_files:
- vars/common_vars
- vars/common_vault
- vars/vars
- vars/vault
vars:
- project_stage_dir: "{{ stage_dir }}/{{ project_id }}/{{ inventory_hostname }}"
tasks:
- name: setup
debug: msg="gathered info from host"
- name: stop the docker containers on gateway
hosts: gateway
vars_files:
- vars/common_vars
- vars/common_vault
- vars/vars
- vars/vault
vars:
- project_stage_dir: "{{ stage_dir }}/{{ project_id }}/{{ inventory_hostname }}"
- compose_command: "stop"
tasks:
- name: "stop the containers"
command: "docker stop {{ project_id }}_exchange {{ project_id }}_kibana {{ project_id }}_kibana_authlog {{ project_id }}_kibana_oauth2 {{ project_id }}_elasticsearch_authlog {{ project_id }}_elasticsearch_oauth2"
ignore_errors: yes
- name: "remove the containers"
command: "docker rm -vf {{ project_id }}_exchange {{ project_id }}_kibana {{ project_id }}_kibana_authlog {{ project_id }}_kibana_oauth2 {{ project_id }}_elasticsearch_authlog {{ project_id }}_elasticsearch_oauth2"
ignore_errors: yes
- name: stop the docker containers on nodes
hosts: nodes
vars_files:
- vars/common_vars
- vars/common_vault
- vars/vars
- vars/vault
vars:
- project_stage_dir: "{{ stage_dir }}/{{ project_id }}/{{ inventory_hostname }}"
- node_id: "{% for node in groups.nodes %}{% if inventory_hostname == node %}{{ -1 + loop.index }}{% endif %}{% endfor %}"
tasks:
- name: "stop the logstash connectors on nodes"
command: "docker stop {{ project_id }}_connector_{{ node_id }}"
ignore_errors: yes
- name: "stop the kafka cluster on nodes"
command: "docker stop {{ project_id }}_kafka_{{ node_id }}"
ignore_errors: yes
- name: "stop the elasticsearch cluster on nodes"
command: "docker stop {{ project_id }}_elasticsearch_{{ node_id }}"
ignore_errors: yes
- name: "remove the logstash connectors on nodes"
command: "docker rm -vf {{ project_id }}_connector_{{ node_id }}"
ignore_errors: yes
- name: "remove the kafka cluster on nodes"
command: "docker rm -vf {{ project_id }}_kafka_{{ node_id }}"
ignore_errors: yes
- name: "remove the elasticsearch cluster on nodes"
command: "docker rm -vf {{ project_id }}_elasticsearch_{{ node_id }}"
ignore_errors: yes