libreddit-loadbalance-demo/Makefile

105 lines
2.1 KiB
Makefile

# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
define configure_ping
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/ping.yml
endef
define configure_base
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/playbook.yml
endef
define configure_loadbalance
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/loadbalance.yml
endef
define configure_libreddit
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/libreddit.yml
endef
define test_base
. ./venv/bin/activate && \
cd tests/ && \
py.test --hosts='ansible://all' \
-n 10 \
--verbose \
--ansible-inventory='../ansible/inventory/hosts.ini' \
test_basic.py
endef
define test_libreddit
. ./venv/bin/activate && \
cd tests/ && \
py.test --hosts='ansible://bullseye_libreddit' \
-n 10 \
--verbose \
--ansible-inventory='../ansible/inventory/hosts.ini' \
test_libreddit.py
endef
define test_loadbalance
. ./venv/bin/activate && \
cd tests/ && \
py.test --hosts='ansible://bullseye_loadbalance' \
-n 10 \
--verbose \
--ansible-inventory='../ansible/inventory/hosts.ini' \
test_loadbalance.py
endef
configure:
$(call configure_ping)
$(call configure_base)
$(call configure_libreddit)
$(call configure_loadbalance)
configure.ping:
$(call configure_ping)
configure.base:
$(call configure_ping)
$(call configure_base)
configure.libreddit:
$(call configure_ping)
$(call configure_libreddit)
configure.loadbalance:
$(call configure_ping)
$(call configure_loadbalance)
lint:
terraform fmt
ansible-lint --write ./ansible/playbook.yml
ansible-lint --write ./ansible/shutdown.yml
ansible-lint --write ./ansible/loadbalance.yml
ansible-lint --write ./ansible/libreddit.yml
. ./venv/bin/activate && black tests/
on:
./scripts/on.sh
virsh list
shutdown:
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/shutdown.yml
test:
$(call test_base)
$(call test_loadbalance)
$(call test_libreddit)
test.base:
$(call test_base)
test.loadbalance:
$(call test_loadbalance)
test.libreddit:
$(call test_libreddit)