-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclean-runners.yml
42 lines (39 loc) · 1.12 KB
/
clean-runners.yml
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
---
- name: define hosts
hosts: localhost
gather_facts: no
tags: [collect]
tasks:
- name: ensure vars are defined
fail:
msg: "{{ item }} must be defined!"
when: lookup('vars', item) is undefined
loop:
- emqx_cluster_name
- emqx_emqx_num
- emqx_loadgen_num
- name: create groups and hosts (emqx)
add_host:
name: "emqx-{{ item }}.int.{{ emqx_cluster_name }}"
group: emqx
ansible_user: ubuntu
loop: "{{ range(0, emqx_emqx_num | int) | list }}"
- name: create groups and hosts (loadgen)
add_host:
name: "loadgen-{{ item }}.int.{{ emqx_cluster_name }}"
group: loadgen
ansible_user: ubuntu
loop: "{{ range(0, emqx_loadgen_num | int) | list }}"
- name: kill lingering scripts
hosts: loadgen
become: yes
become_user: root
tasks:
- name: show offenders
shell: "ps -ef | grep bench | grep -v grep"
register: offenders
- debug:
var: offenders.stdout_lines
- name: kill the scripts
shell: "ps -ef | grep bench | grep -v grep | awk '{print $2}' | xargs kill -9"
...