diff --git a/Makefile b/Makefile index ab43956..13b509c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/ansible/locust/artifacts/docker-compose.yml b/ansible/artifacts/locust/docker-compose.yml similarity index 100% rename from ansible/locust/artifacts/docker-compose.yml rename to ansible/artifacts/locust/docker-compose.yml diff --git a/ansible/playbook.yml b/ansible/base.yml similarity index 81% rename from ansible/playbook.yml rename to ansible/base.yml index 5e65f63..dd36975 100644 --- a/ansible/playbook.yml +++ b/ansible/base.yml @@ -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 diff --git a/ansible/locust/main.yml b/ansible/locust.yml similarity index 85% rename from ansible/locust/main.yml rename to ansible/locust.yml index 06f5f97..695279c 100644 --- a/ansible/locust/main.yml +++ b/ansible/locust.yml @@ -1,8 +1,10 @@ +--- # SPDX-FileCopyrightText: 2023 Aravinth Manivannan # # 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 diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index a204433..5058737 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -28,7 +28,7 @@ name: docker-ce update_cache: true -#- name: Install Docker Module for Python +# - name: Install Docker Module for Python # become: true # community.general.pipx: # name: docker diff --git a/ansible/locust/roles/docker-compose/tasks/main.yml b/ansible/roles/docker_compose/tasks/main.yml similarity index 100% rename from ansible/locust/roles/docker-compose/tasks/main.yml rename to ansible/roles/docker_compose/tasks/main.yml diff --git a/tests/test_basic.py b/tests/test_basic.py index 2bf6dd4..17843e5 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -38,7 +38,6 @@ def test_pkgis_installed(host): "python3-pip", "virtualenv", "python3-setuptools", - "ntp", "ufw", ]: assert host.package(pkg).is_installed