cli: add ioc commands
Deploy and restart modified services / deploy (push) Successful in 18s

This commit is contained in:
Benjamin Labrecque
2026-07-15 08:25:03 +02:00
parent 44335bf30d
commit 2e8b5b6f51
14 changed files with 240 additions and 12 deletions
+49
View File
@@ -0,0 +1,49 @@
import sys
import ansible_runner
import typer
from core.ansible import run_playbook
from core.utils import get_git_root
ioc = typer.Typer(no_args_is_help=True)
REPO_ROOT = get_git_root(__file__)
ANSIBLE_PLAYBOOKS_DIR = REPO_ROOT / "ansible" / "playbooks"
IOC_PLAYBOOK_INSTALL = ANSIBLE_PLAYBOOKS_DIR / "ioc-install.yml"
IOC_PLAYBOOK_RESTART = ANSIBLE_PLAYBOOKS_DIR / "ioc-restart.yml"
IOC_PLAYBOOK_START = ANSIBLE_PLAYBOOKS_DIR / "ioc-start.yml"
@ioc.command(no_args_is_help=True)
def install(
env: str = typer.Option(..., "--env"),
service_name_lower: str = typer.Option(..., "--service-name", "-s"),
):
env_var = f"agebd_env={env}"
branch_var = f"branch_name=feature/add-service-{service_name_lower}"
service_name_var = f"service_name_lower={service_name_lower}"
run_playbook(playbook=str(IOC_PLAYBOOK_INSTALL), vars=[env_var, branch_var, service_name_var])
@ioc.command(no_args_is_help=True)
def restart(
env: str = typer.Option(..., "--env"),
service_name_lower: str = typer.Option(..., "--service-name", "-s"),
):
env_var = f"agebd_env={env}"
branch_var = f"branch_name=feature/add-service-{service_name_lower}"
service_name_var = f"service_name_lower={service_name_lower}"
run_playbook(playbook=str(IOC_PLAYBOOK_RESTART), vars=[env_var, branch_var, service_name_var])
@ioc.command(no_args_is_help=True)
def start(
ioc_port: int = typer.Option(..., "--port", "-p"),
):
ioc_port_var = f"ioc_port={ioc_port}"
run_playbook(playbook=str(IOC_PLAYBOOK_START), vars=[ioc_port_var])