question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ansible Galaxy 'Lock' file support

See original GitHub issue

Original issue is abandonded in archived galaxy-issues project The related issue about versioning of roles is migrated: https://github.com/ansible/galaxy/issues/83

Original issue by @geerlingguy

It would be helpful if Ansible Galaxy supported a ‘lock’ file.

When running ansible-galaxy install -r requirements.yml, Ansible Galaxy could create a requirements.lock file (or some other name) that stores the following metadata for each downloaded role:

  • Role name
  • Role version or branch identifier used
  • Specific git tag or hash downloaded

Then, if running the command ansible-galaxy install -r requirements.yml again, it would install based on the exact identifiers in the lock file.

The details could be a little different, of course, and we’d need a command like ansible-galaxy update -r requirements.yml to update an existing lockfile… but this would make idempotent playbook configurations much easier for many projects without requiring all downloaded roles be stored in the project repository (e.g. like Drupal VM currently does).

Other examples of lock file support:

Original Request

For Drupal VM, we’ve decided to pin our requirements.yml file’s role requirements to specific versions (e.g. 3.0.1, 2.5.0, etc.).

It would be nice if we could support some method of semver with role versions (instead of just requiring a branch or tag… and maybe this is related to/duplicate of #70), where you could specify a dependency in requirements.yml like:

- src: geerlingguy.apache
  version: 1.7.*

When galaxy picks the tag to pull, it would check for any in the 1.7.x range, and choose the latest release. That way I don’t have to spend so much time maintaining all my requirements files for various projects.

I would love to see something as involved as Composer’s Version support, but I know that’s a bit of a moonshot. It would be nice to have a lock file that would set the versions currently installed, too, as that would even allow me to set master but lock in the versions at a specific point in time.

Anyways, I was just thinking about how awesome it is to point at tagged role releases in terms of keeping one’s playbook completely idempotent and stable—yet how annoying it is to have to manually tinker with the requirements.yml file so often.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
geerlingguycommented, Mar 12, 2020

Related, but slightly different to this particular feature request: it would also be nice if we could allow version constraints for collections in requirements.yml and on the CLI, so I opened https://github.com/ansible/ansible/issues/68194. Finally, to allow upgrading of dependencies, it would be nice to have the ability to upgrade using ansible-galaxy: https://github.com/ansible/ansible/issues/65699

0reactions
AlanCodingcommented, Mar 12, 2020

ansible-galaxy collection verify and ansible-galaxy collection list were recently added and have some bearing on this. The verify command pulls the checksums from the server and verifies the installed version against that. The way I read this is that the lock file would contain those checksums, and could be validated against (interacting with the server is very slow). That also seems like a stretch goal, whereas producing versions (like the list command) and putting that into a valid requirements.yml file would take a short time to develop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ansible-galaxy
Creates the skeleton framework of a role or collection that complies with the Galaxy metadata format. Requires a role or collection name.
Read more >
Examples — Ansible Documentation
Determining Where Roles Are Installed · Role Versions · Listing Your Installed Roles · Installing Multiple Roles From a File ...
Read more >
Galaxy User Guide - Ansible Documentation
Galaxy User Guide . Ansible Galaxy refers to the Galaxy website, a free site for finding, downloading, and sharing community developed roles....
Read more >
azure.azcollection.azure_rm_lock_info module – Manage ...
To install it, use: ansible-galaxy collection install azure.azcollection . ... Use when authenticating with an Active Directory user rather than service ...
Read more >
Ansible Galaxy: Collections and Roles
Roles allow you to do away with the need to include files. There is no need to specify file paths or include directives...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found