summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-12-23 11:00:04 +0200
committerLars Wirzenius <liw@liw.fi>2023-12-23 11:00:04 +0200
commit222710d2142c0c11fc7e1699eb56a2a25bd3bdeb (patch)
treed24ff3bb3ea6c00f2dc1a5ef97343374b2235c7d
parenta79a0d6cb1e1249d77859ab65fe14123bf326780 (diff)
downloadambient-build-vm-222710d2142c0c11fc7e1699eb56a2a25bd3bdeb.tar.gz
fix(ambient-build-vm): actually use all specified playbooks
Previously only the last one was used. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
-rwxr-xr-xambient-build-vm9
1 files changed, 4 insertions, 5 deletions
diff --git a/ambient-build-vm b/ambient-build-vm
index a2eebc6..49a1c3e 100755
--- a/ambient-build-vm
+++ b/ambient-build-vm
@@ -40,7 +40,7 @@ def parse_args():
p.add_argument(
"--playbook",
- action="store",
+ action="append",
help="extra Ansible playbook to use with vmdb to build image (default is none)",
)
@@ -70,19 +70,18 @@ def write_yaml(filename, obj):
def prepare_build_files(tmp, args):
vmdb_filename = os.path.join(tmp, "image.vmdb")
playbook_filename = os.path.join(tmp, "playbook.yml")
- extra_playbook_filename = os.path.join(tmp, "extra.yml")
vmdb = load_yaml(join(args, BASE_VMDB))
- if args.playbook is not None:
+ for playbook in args.playbook:
vmdb["steps"].append(
{
# note: the value MUST be the root file system tag in the VMDB file
"ansible": "/",
- "playbook": args.playbook,
+ "playbook": playbook,
}
)
- shutil.copyfile(args.playbook, extra_playbook_filename)
+ shutil.copyfile(playbook, os.path.join(tmp, playbook))
write_yaml(vmdb_filename, vmdb)
shutil.copyfile(join(args, BASE_PLAYBOOK), playbook_filename)