spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.92k stars 1.05k forks source link

Create ansible collection #947

Open papanito opened 3 years ago

papanito commented 3 years ago

As I understand this is a playbook which includes roles under /roles. As the roles are part of the content and not individually release, it would be nice to provide an ansible collection.

Having a collection would rather make it easy to consume the matrix roles in your own playbook.

spantaleev commented 3 years ago

Somewhat related to #80?

papanito commented 3 years ago

@spantaleev yeah somewhat. Collections are quite new and I think it's easier to achieve as to my understanding one only has to create a specific structure

Collections follow a simple data structure. None of the directories are required unless you have specific content that belongs in one of them. A collection does require a galaxy.yml file at the root level of the collection. This file contains all of the metadata that Galaxy and other tools need in order to package, build and publish the collection:

collection/
├── docs/
├── galaxy.yml
├── meta/
│   └── runtime.yml
├── plugins/
│   ├── modules/
│   │   └── module1.py
│   ├── inventory/
│   └── .../
├── README.md
├── roles/
│   ├── role1/
│   ├── role2/
│   └── .../
├── playbooks/
│   ├── files/
│   ├── vars/
│   ├── templates/
│   └── tasks/
└── tests/

Which, if I see correctly, also eliminates the need to have the roles independent as stated in #80

Also important:

Role names are now limited to contain only lowercase alphanumeric characters, plus _ and start with an alpha character.

papanito commented 3 years ago

If you tell me this is something to try, I might have a look. Never made a collection, but definitively something I would like to help

papanito commented 3 years ago

@spantaleev here an example of how the repos should be restructured to be an ansible collection

https://github.com/papanito/matrix-docker-ansible-deploy/tree/papanito/ansible-collection

So far I only made the necessary changes to be able to upload it to ansible galaxy, still needs testing. Same goes for your playbook - it was moved to playbooks folder but did not test it yet.

Also the README should probably be updated. But before I go on I would like to hear your opinion/feedback.

dev-zero commented 3 years ago

This would be really nice. Are there plans to avoid breaking things for current users?

papanito commented 3 years ago

The playbooks may need some adjustments but I believe it should be doable without breaking the playbooks. Ultimately the roles are the same just they will just be belong to a collection...