Skip to content
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

Add a guide page that explains various mechanisms for developing a collection #1952

Open
sivel opened this issue Sep 26, 2024 · 5 comments
Open

Comments

@sivel
Copy link
Member

sivel commented Sep 26, 2024

There have been numerous times where users have attempted to git clone a repo, cd into it, and attempt running ansible-playbook playbooks/some_playbook.yml to test a collection. In this manner ansible-core has no context that the playbook is in a collection, nor will changes be made to core to support any attempted magic at doing so.

This may be related to lack of documentation about common ways to develop collections, so we should expand on this further.

My typical approach generally revolves around isolation.

  1. Create a project directory

  2. inside that project directory create a collections directory

  3. git clone or init a collection repo into the proper directory structure of collections/<namespace>/<name>

  4. Develop content in the project directory to manually develop the collection, this may involve creating a playbook like runme.yml which does something like which can be executed:

    import_playbook: <namespace>.<name>.<playbook_name>
    

Other mechanisms, such as that documented for ansible-dev-environment may be useful for the guide as well.

I'm sure others may have ideas, but I generally recommend not using global collection dirs, nor using ansible-galaxy collection install git+..., and instead just directly interacting with git and proper directory structures that ansible-core supports.

@ansible-documentation-bot ansible-documentation-bot bot added the needs_triage Needs a first human triage before being processed. label Sep 26, 2024
@sivel
Copy link
Member Author

sivel commented Sep 26, 2024

cc @cidrblock

@acozine
Copy link
Contributor

acozine commented Oct 1, 2024

We currently have https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_creating.html - should we expand that documentation, or create something new, or both?

@sivel
Copy link
Member Author

sivel commented Oct 1, 2024

I'd be fine with extending that. As of now it leaves a lot to the reader.

@samccann
Copy link
Contributor

samccann commented Oct 8, 2024

@Andersson007 just Fyi ^^

@samccann samccann removed the needs_triage Needs a first human triage before being processed. label Oct 8, 2024
@Andersson007
Copy link
Contributor

Should we maybe ask the community to help here? via Bullhorn / community-wg post ?
Speaking about ansible-dev-env, etc. i would mention it in seealso maybe but would limit the guide itself with only essential things like git and tools provided by ansible-core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 Triage
Development

No branches or pull requests

4 participants