From 57bdfef75483cd156c65ce5121341aeb95d51b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 9 Sep 2019 08:55:20 +0200 Subject: [PATCH] stages/ansible: Drop the ansible stage We use chroot connection type to "connect" to the target filesystem where ansible should run the playbook. However, the target is not booted system, it's just an image of not-yet-booted one. Unfortunately, many ansible modules cannot be used inside not-booted system. Also, the core principle of osbuild is to never boot the currently built image. Therefore we decided to remove the ansible stage. If ansible is needed in the future, there is a possibility to add a new ansible stage, which would run the playbook during the first boot. --- stages/org.osbuild.ansible | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100755 stages/org.osbuild.ansible diff --git a/stages/org.osbuild.ansible b/stages/org.osbuild.ansible deleted file mode 100755 index f64b9059..00000000 --- a/stages/org.osbuild.ansible +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python3 - -import json -import subprocess -import sys - - -def main(tree, options): - playbook = options["playbook"] - - with open("/tmp/inventory", "w") as f: - f.write(f"osbuild-tree ansible_connection=chroot ansible_host={tree} " - f"ansible_python_interpreter=/usr/bin/python3") - - with open("/tmp/playbook.yml", "w") as f: - if isinstance(playbook, str): - f.write(playbook) - else: - json.dump(playbook, f) - - r = subprocess.run([ - "ansible-playbook", "-v", - "--connection", "chroot", - "--inventory", "/tmp/inventory", - "/tmp/playbook.yml" - ]) - - return r.returncode - -if __name__ == '__main__': - args = json.load(sys.stdin) - ret = main(args["tree"], args["options"]) - sys.exit(ret)