chore: refactor playbooks

This commit is contained in:
Aravinth Manivannan 2023-10-13 16:28:38 +05:30
parent 1158590b7f
commit 4186f1eb47
Signed by: realaravinth
GPG key ID: F8F50389936984FF
7 changed files with 12 additions and 17 deletions

View file

@ -16,7 +16,7 @@ endef
define configure_locust
. ./venv/bin/activate && \
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/locust/main.yml
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/locust.yml
endef
define test_base
@ -46,9 +46,9 @@ endef
# ```bash
# INVENTORY=./terraform/dos/hosts.ini make conf.base
# ```
conf.base: ## Get all VMs to base level configuration
$(call configure_base)
#conf.base: ## Get all VMs to base level configuration
# $(call configure_base)
#
lint: ## Lint source code
terraform fmt
@ -60,7 +60,6 @@ lint: ## Lint source code
# INVENTORY=./terraform/dos/hosts.ini make conf.base
# ```
conf.dos: ## Configure all DoS VMs
$(call configure_base)
$(call configure_locust)
# ```bash

View file

@ -4,7 +4,7 @@
---
- name: Install and enable firewall
hosts: [mcaptcha_dos, mcaptcha_demo_server, mcaptcha_mcaptcha]
hosts: all
remote_user: atm
pre_tasks:
- name: Ensure all VMs are reachable
@ -28,9 +28,3 @@
- virtualenv
- python3-setuptools
- ufw
- name: Install Docker
hosts: mcaptcha_dos
remote_user: atm
roles:
- docker

View file

@ -1,8 +1,10 @@
---
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
- name: Base configuration
ansible.builtin.import_playbook: base.yml
---
- name: Configure Locust instances
hosts: [mcaptcha_dos]
remote_user: atm
@ -10,7 +12,8 @@
- name: Ensure all VMs are reachable
ansible.builtin.ping:
roles:
- docker-compose
- docker
- docker_compose
tasks:
- name: Allow port 8089 for locust
@ -31,7 +34,7 @@
- name: Copy docker-compose.yml file
become: true
ansible.builtin.copy:
src: ./artifacts/docker-compose.yml
src: ./artifacts/locust/docker-compose.yml
dest: /etc/locust/
- name: Start locust services

View file

@ -38,7 +38,6 @@ def test_pkgis_installed(host):
"python3-pip",
"virtualenv",
"python3-setuptools",
"ntp",
"ufw",
]:
assert host.package(pkg).is_installed