chore: refactor playbooks
This commit is contained in:
parent
1158590b7f
commit
4186f1eb47
7 changed files with 12 additions and 17 deletions
9
Makefile
9
Makefile
|
@ -16,7 +16,7 @@ endef
|
||||||
|
|
||||||
define configure_locust
|
define configure_locust
|
||||||
. ./venv/bin/activate && \
|
. ./venv/bin/activate && \
|
||||||
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/locust/main.yml
|
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/locust.yml
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define test_base
|
define test_base
|
||||||
|
@ -46,9 +46,9 @@ endef
|
||||||
# ```bash
|
# ```bash
|
||||||
# INVENTORY=./terraform/dos/hosts.ini make conf.base
|
# INVENTORY=./terraform/dos/hosts.ini make conf.base
|
||||||
# ```
|
# ```
|
||||||
conf.base: ## Get all VMs to base level configuration
|
#conf.base: ## Get all VMs to base level configuration
|
||||||
$(call configure_base)
|
# $(call configure_base)
|
||||||
|
#
|
||||||
|
|
||||||
lint: ## Lint source code
|
lint: ## Lint source code
|
||||||
terraform fmt
|
terraform fmt
|
||||||
|
@ -60,7 +60,6 @@ lint: ## Lint source code
|
||||||
# INVENTORY=./terraform/dos/hosts.ini make conf.base
|
# INVENTORY=./terraform/dos/hosts.ini make conf.base
|
||||||
# ```
|
# ```
|
||||||
conf.dos: ## Configure all DoS VMs
|
conf.dos: ## Configure all DoS VMs
|
||||||
$(call configure_base)
|
|
||||||
$(call configure_locust)
|
$(call configure_locust)
|
||||||
|
|
||||||
# ```bash
|
# ```bash
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
- name: Install and enable firewall
|
- name: Install and enable firewall
|
||||||
hosts: [mcaptcha_dos, mcaptcha_demo_server, mcaptcha_mcaptcha]
|
hosts: all
|
||||||
remote_user: atm
|
remote_user: atm
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Ensure all VMs are reachable
|
- name: Ensure all VMs are reachable
|
||||||
|
@ -28,9 +28,3 @@
|
||||||
- virtualenv
|
- virtualenv
|
||||||
- python3-setuptools
|
- python3-setuptools
|
||||||
- ufw
|
- ufw
|
||||||
|
|
||||||
- name: Install Docker
|
|
||||||
hosts: mcaptcha_dos
|
|
||||||
remote_user: atm
|
|
||||||
roles:
|
|
||||||
- docker
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
---
|
||||||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
- name: Base configuration
|
||||||
|
ansible.builtin.import_playbook: base.yml
|
||||||
|
|
||||||
---
|
|
||||||
- name: Configure Locust instances
|
- name: Configure Locust instances
|
||||||
hosts: [mcaptcha_dos]
|
hosts: [mcaptcha_dos]
|
||||||
remote_user: atm
|
remote_user: atm
|
||||||
|
@ -10,7 +12,8 @@
|
||||||
- name: Ensure all VMs are reachable
|
- name: Ensure all VMs are reachable
|
||||||
ansible.builtin.ping:
|
ansible.builtin.ping:
|
||||||
roles:
|
roles:
|
||||||
- docker-compose
|
- docker
|
||||||
|
- docker_compose
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Allow port 8089 for locust
|
- name: Allow port 8089 for locust
|
||||||
|
@ -31,7 +34,7 @@
|
||||||
- name: Copy docker-compose.yml file
|
- name: Copy docker-compose.yml file
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: ./artifacts/docker-compose.yml
|
src: ./artifacts/locust/docker-compose.yml
|
||||||
dest: /etc/locust/
|
dest: /etc/locust/
|
||||||
|
|
||||||
- name: Start locust services
|
- name: Start locust services
|
|
@ -38,7 +38,6 @@ def test_pkgis_installed(host):
|
||||||
"python3-pip",
|
"python3-pip",
|
||||||
"virtualenv",
|
"virtualenv",
|
||||||
"python3-setuptools",
|
"python3-setuptools",
|
||||||
"ntp",
|
|
||||||
"ufw",
|
"ufw",
|
||||||
]:
|
]:
|
||||||
assert host.package(pkg).is_installed
|
assert host.package(pkg).is_installed
|
||||||
|
|
Loading…
Reference in a new issue