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.
This commit is contained in:
Ondřej Budai 2019-09-09 08:55:20 +02:00
parent f78db47a0e
commit 57bdfef754

View file

@ -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)