iac/ansible/locust/main.yml

43 lines
975 B
YAML
Raw Normal View History

2023-08-17 05:06:08 +05:30
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Configure Locust instances
hosts: [mcaptcha_dos]
remote_user: atm
pre_tasks:
- name: Ensure all VMs are reachable
ansible.builtin.ping:
roles:
- docker-compose
tasks:
- name: Allow port 8089 for locust
become: true
community.general.ufw:
state: enabled
rule: allow
proto: tcp
port: "8089"
- name: Create projects dir
become: true
ansible.builtin.file:
path: /etc/locust
state: directory
mode: "0755"
- name: Copy docker-compose.yml file
become: true
ansible.builtin.copy:
src: ./artifacts/docker-compose.yml
dest: /etc/locust/
- name: Start locust services
become: true
community.docker.docker_compose:
project_src: /etc/locust/
scale:
worker: 4