Skip to content

Commit 803e1ea

Browse files
authored
Merge pull request #35 from nsec/verboseansible
When `--verbose` is checked, increase verbosity of ansible playbooks …
2 parents 6b4c829 + 4a2fe35 commit 803e1ea

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

ctf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616

1717
ENV = {}
18+
STATE = {"verbose": False}
1819
for k, v in os.environ.items():
1920
ENV[k] = v
2021

ctf/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typer import Typer
77
from typing_extensions import Annotated
88

9-
from ctf import ENV, LOG
9+
from ctf import ENV, LOG, STATE
1010
from ctf.check import app as check_app
1111
from ctf.deploy import app as deploy_app
1212
from ctf.destroy import app as destroy_app
@@ -52,6 +52,7 @@ def global_options(
5252
if verbose:
5353
LOG.setLevel(logging.DEBUG)
5454
LOG.handlers[0].setLevel(logging.DEBUG)
55+
STATE["verbose"] = True
5556

5657
if location:
5758
ENV["CTF_ROOT_DIR"] = location

ctf/deploy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import typer
88
from typing_extensions import Annotated
99

10-
from ctf import ENV
10+
from ctf import ENV, STATE
1111
from ctf.destroy import destroy
1212
from ctf.generate import generate
1313
from ctf.logger import LOG
@@ -224,6 +224,8 @@ def deploy(
224224

225225
def run_ansible_playbook(remote: str, production: bool, track: str, path: str) -> None:
226226
extra_args = []
227+
if STATE["verbose"]:
228+
extra_args.append("-vvv")
227229
if remote:
228230
extra_args += ["-e", f"ansible_incus_remote={remote}"]
229231

ctf/templates/new/common/inventory.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This YAML file defines all machines that Ansible needs to know about to run playbooks and configure machines.
22
all:
33
hosts:
4-
# The following line defines how this machine will be refered to in ansible scripts.
4+
# The following line defines how this machine will be referred to in ansible scripts.
55
{{ data.name }}:
66
# This one tells ansible that this host is reached using incus, and the name of the machine in incus is `{{ data.name }}`.
77
ansible_incus_host: {{ data.name }}

0 commit comments

Comments
 (0)