1- name: Kill all mongod processes
2  command: pkill  -{{ kill_signal }} mongod
3  ignore_errors: true
4
5- name: Kill all mongos processes
6  command: pkill  -{{ kill_signal }} mongos
7  ignore_errors: true
8
9- name: Wait for ports to get out of TIME_WAIT
10  wait_for:
11    port: '{{ item }}'
12    state: drained
13  with_sequence: start=3001 end=3006
14
15- name: Remove all mongod folders
16  file:
17    path: "{{ remote_tmp_dir }}/{{ item }}"
18    state: absent
19  with_items:
20    - mongod3001
21    - mongod3002
22    - mongod3003
23    - mongod3004
24    - mongod3005
25    - mongod3006
26    - config
27
28- name: Remove all mongod sock files
29  shell: rm -Rf /tmp/mongodb*.sock
30