lxc / incus-deploy

Deployment playbooks, configurations and scripts for Incus
Apache License 2.0
48 stars 17 forks source link

Make ansible role consumable from requirements.yml #4

Open mweinelt opened 7 months ago

mweinelt commented 7 months ago

I'm wondering what the intended way to make use of the playbooks is. Generally we would reference the git repository in our requirements.yml, but the current directory structure seems unsuitable for that.

https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#installing-multiple-roles-from-a-file

This is how I would expect to use it:

roles:
  - name: lxc.incus
    src: https://github.com/lxc/incus-deploy
    scm: git

And this is how it currently fails.

$ ansible-galaxy install -r requirements.yml
[...]
[WARNING]: - lxc.incus was NOT installed successfully: this role does not appear to have a meta/main.yml file.

For one, I think the ansible directory is not something that can be referenced from a requirements.yml, but also the role is missing a meta/main.yaml, likely with a galaxy_info dict.

https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#using-meta-main-yml

WDYT?

stgraber commented 7 months ago

Currently our repository isn't setup to expose actual Ansible roles, that's something that we'll want to work on but will require a bunch more restructuring and fixes on our side.

Hopefully we can find someone who's more familiar with creating properly consumable Ansible roles who can help put that together while also not regressing the simple case of just deploy Incus/OVN/Ceph in one shot through this.

mttjohnson commented 7 months ago

We can keep everything in the same repo and utilize roles without using ansible-galaxy and having roles maintained in a separate repo. We can just create a roles directory and just reference them. All ansible-galaxy does is operate as a package manager of sorts to go fetch roles from other places and bring them into the roles directory for us. This would help keep things simple for now until there is a need for wanting to package the ansible role into a separate distributable role for others to consume and bring into their own custom playbooks.

Based on how each playbooks is broken out into multiple plays, I expect most of the hard work or organizing things is already done, and the roles could probably be defined similarly.

I could re-organize things into roles as a pull request, but I'm hesitant to re-arrange things until I'm able to test it myself, and I'm waiting on some new equipment to come in next week which I'm expecting will allow me to test all this.

stgraber commented 7 months ago

Yeah, we definitely want to avoid causing regressions at this stage :)

I'll be traveling next week so won't be able to easily test pull requests coming in, so no rush, we can make some progress on this stuff once you can run it for yourself!

mkbrechtel commented 7 months ago

I am also willing to help with the refactoring. We can also provide some infrastructure to test.

stgraber commented 7 months ago

I need to do some cleanup on my Github self-hosted test runners but once that's done I should be able to have this repo be able to grab some pretty sizable test runners (64GB of RAM and 8 vCPU or something like that) which would then allow for a normal Github Action workflow to run both the Terraform and Ansible parts of this.

panfantastic commented 7 months ago

I am interested in the refactor and can help contribute. I can also offer some decently sized VMs for running test runners.

mkbrechtel commented 6 months ago

I started working on the refactoring, see #7

https://github.com/mkbrechtel/incus-deploy/tree/refactoring