tests: Add a simple benchmarking playbook
The playbook creates a specified number of fake hosts (as localhost) and runs a task file against them a specified number of times. By default it will create 25 hosts and run 50 tasks against them, providing 1250 results. Change-Id: I88642041d8cee3c11f9d993d6dca245d7eb33f8e
This commit is contained in:
parent
40894c7027
commit
f6df57d25c
29
tests/integration/benchmark.yaml
Normal file
29
tests/integration/benchmark.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Create many hosts
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
vars:
|
||||
benchmark_host_count: 25
|
||||
tasks:
|
||||
- name: Add a host to the inventory
|
||||
add_host:
|
||||
ansible_connection: local
|
||||
hostname: "host-{{ item }}"
|
||||
groups: benchmark
|
||||
with_sequence: start=1 end={{ benchmark_host_count }}
|
||||
|
||||
- name: Run tasks on many hosts
|
||||
hosts: benchmark
|
||||
vars:
|
||||
benchmark_task_file: "{{ playbook_dir }}/benchmark_tasks.yaml"
|
||||
# Run N tasks per host
|
||||
benchmark_task_count: 50
|
||||
# Off by default to prevent accidental load spike on localhost
|
||||
benchmark_gather_facts: no
|
||||
gather_facts: "{{ benchmark_gather_facts }}"
|
||||
tasks:
|
||||
- name: Include a task file
|
||||
include_tasks: "{{ benchmark_task_file }}"
|
||||
with_sequence: start=1 end={{ benchmark_task_count }}
|
8
tests/integration/benchmark_tasks.yaml
Normal file
8
tests/integration/benchmark_tasks.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# These are tasks meant to be imported by benchmark.yaml
|
||||
|
||||
- name: Run a task
|
||||
debug:
|
||||
msg: "{{ inventory_hostname }} running task #{{ item }}"
|
Loading…
x
Reference in New Issue
Block a user