diff --git a/ctf/__init__.py b/ctf/__init__.py index 352f421..245a937 100644 --- a/ctf/__init__.py +++ b/ctf/__init__.py @@ -15,6 +15,7 @@ ENV = {} +STATE = {"verbose": False} for k, v in os.environ.items(): ENV[k] = v diff --git a/ctf/__main__.py b/ctf/__main__.py index 118025c..78e6edd 100644 --- a/ctf/__main__.py +++ b/ctf/__main__.py @@ -6,7 +6,7 @@ from typer import Typer from typing_extensions import Annotated -from ctf import ENV, LOG +from ctf import ENV, LOG, STATE from ctf.check import app as check_app from ctf.deploy import app as deploy_app from ctf.destroy import app as destroy_app @@ -52,6 +52,7 @@ def global_options( if verbose: LOG.setLevel(logging.DEBUG) LOG.handlers[0].setLevel(logging.DEBUG) + STATE["verbose"] = True if location: ENV["CTF_ROOT_DIR"] = location diff --git a/ctf/deploy.py b/ctf/deploy.py index 49a7e3f..66cb4c9 100644 --- a/ctf/deploy.py +++ b/ctf/deploy.py @@ -7,7 +7,7 @@ import typer from typing_extensions import Annotated -from ctf import ENV +from ctf import ENV, STATE from ctf.destroy import destroy from ctf.generate import generate from ctf.logger import LOG @@ -224,6 +224,8 @@ def deploy( def run_ansible_playbook(remote: str, production: bool, track: str, path: str) -> None: extra_args = [] + if STATE["verbose"]: + extra_args.append("-vvv") if remote: extra_args += ["-e", f"ansible_incus_remote={remote}"] diff --git a/ctf/templates/new/common/inventory.j2 b/ctf/templates/new/common/inventory.j2 index bfa674e..aa0d3e4 100644 --- a/ctf/templates/new/common/inventory.j2 +++ b/ctf/templates/new/common/inventory.j2 @@ -1,7 +1,7 @@ # This YAML file defines all machines that Ansible needs to know about to run playbooks and configure machines. all: hosts: - # The following line defines how this machine will be refered to in ansible scripts. + # The following line defines how this machine will be referred to in ansible scripts. {{ data.name }}: # This one tells ansible that this host is reached using incus, and the name of the machine in incus is `{{ data.name }}`. ansible_incus_host: {{ data.name }}