From 115d8601f636c5ad755416cd541efab5d0bf0507 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Tue, 8 Jul 2025 20:42:56 -0500 Subject: [PATCH] Set become method via variable It seems like setting the `ansible_become_method` variable as a group variable overrides the `--become-method` CLI argument. If we set the variable on the command line, that _should_ take precedence. --- host_provisioner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host_provisioner.py b/host_provisioner.py index a9560ca..7130789 100644 --- a/host_provisioner.py +++ b/host_provisioner.py @@ -63,7 +63,7 @@ def amqp_connect() -> pika.BlockingConnection: def apply_playbook(*args: str) -> None: - cmd = ['ansible-playbook', '-u', 'root', '--become-method', 'su'] + cmd = ['ansible-playbook', '-u', 'root', '-e' 'ansible_become_method', 'su'] cmd += args log.debug('Running command: %s', cmd) subprocess.run(cmd, check=True, stdin=subprocess.DEVNULL)