-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create chroots if they are missing #3
Comments
One cannot just store arbitrary values in a playbook, as ansible will complain:
However, I can store arbitrary key/value pairs in ansible variables However, ansible provides a chaotic evil amount of places and ways one can set and generate variables. Also ansible, being uncooperative as usual, does not, as far as I know, provide any kind of library that one could use to load a playbook, put together all its pieces and resolve/introspect variables. However, I could run a modified playbook that prints variable values. But then I'd need a playbook for maintenance and a playbook for variable lookups. Plus, given ansible's inefficiency, I'd like to avoid running a whole playbook just to figure out chroot details. However, I can sidestep the whole problem, supporting only variables explictly defined in the playbook file itself, However, there is no YAML parsing library in the Python standard library, and there are two widespread libraries to choose from, with slightly incompatible APIs. However, I've already shaved that yak before, # Import YAML for parsing only. Prefer pyyaml for loading, because it's
# significantly faster
try:
import yaml
def yaml_load(file):
return yaml.load(file, Loader=yaml.CLoader)
except ModuleNotFoundError:
try:
import ruamel.yaml
yaml_loader = ruamel.yaml.YAML(typ="safe", pure=True)
def yaml_load(file):
return yaml_loader.load(file)
except ModuleNotFoundError:
def yaml_load(file):
raise NotImplementedError("this feature requires PyYaml or ruamel.yaml") At this point, I can define a Here's an example chroot configuration snippet: - name: "Basic buster chroot"
vars:
nspawn_runner_chroot_suite: buster
hosts: all
user: root
tasks:
… |
This is now done in c727706 |
It would be nice to also have
nspawn-runner
create the chroots from configuration files if they are missing, so that a new runner can be deployed with a minimal effort, and it will proceed to generate all the images required in a single command.The text was updated successfully, but these errors were encountered: