Add example of ansible provisioning with playbook#2676
Conversation
|
Is there a way to reference environment variables from inside the playbook? I realized that tests in #2570 don't verify that the |
I think you can do something like https://docs.ansible.com/ansible/latest/collections/ansible/builtin/env_lookup.html Then there is the |
|
I will add a separate test for params, they should be propagated but they fail to validate: field We will just add them to the environment of the |
100be8b to
587ff3e
Compare
a789c5f to
3fbb14f
Compare
Currently the playbook is relative to the current workdir, it should probably be relative to the lima.yaml instead. The YAML syntax and the directory layout has been modified slightly from the original, to work with Lima's setup. Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
3fbb14f to
775c05a
Compare
There was a problem hiding this comment.
Not sure if we want to put non-lima yamls to the template store.
Maybe we should have a examples/ directory?
There was a problem hiding this comment.
Not sure if we want to put non-lima yamls to the template store.
We don't because they would be included in limactl create --list-templates, which would be confusing.
There was a problem hiding this comment.
It needs to be next to the template, so that it can be referenced.
provision:
- mode: ansible
playbook: ./templates/ansible/playbook.yamlIt could probably use the new feature for scripts:
|
Should be rewritten with the new feature to assemble templates. i.e. provision:
- mode: ansible
file:
url: ./templates/ansible/playbook.yamlCurrently it is being read into script, but should also be for playbook. NOTE: The playbook is recursive, so needs to be parsed to be embedded... Unfortunately Ansible does not provide a good way to use a single yaml file. I have no idea if embedding works for scripts that include functions from files... |
Yes, it should. Once created, instances should not rely on any external files. Unfortunately there don't seem to be any tools to flatten playbooks; we would have to implement it ourselves. I'll create an issue for it, but I won't get around to it for quite a while. |
Example for:
This has the same problem with relative paths, as was fixed for the scripts:
commit 3b33549
Currently it uses the working directory, so it only works from the git repo top.
$ limactl start ./templates/ansible.yamlWith the awesome Unicode Unicow: