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.

Specify Collection for Galaxy dependency

See original GitHub issue

Issue Type

  • Feature request

Molecule and Ansible details

ansible --version && molecule --version
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/artis3n/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/artis3n/.local/share/virtualenvs/dev-setup-cQlga8yo/lib/python3.7/site-packages/ansible
  executable location = /home/artis3n/.local/share/virtualenvs/dev-setup-cQlga8yo/bin/ansible
  python version = 3.7.5 (default, Nov 24 2019, 17:46:35) [GCC 9.2.1 20191008]

molecule, version 2.22

Molecule installation method (one of):

  • source
  • pip (pipenv)

Ansible installation method (one of):

  • source
  • pip (pipenv)
  • OS package

Desired Behavior

dependency:
  name: galaxy
  options:
    role-file: requirements.yml
    collection-file: requirements.yml

With a requirements.yml format following https://docs.ansible.com/ansible/devel/user_guide/collections_using.html#install-multiple-collections-with-a-requirements-file:

---

roles:
- src: gantsign.visual-studio-code
- src: artis3n.bitwarden_app

collections:
- name: artis3n.github

Molecule’s galaxy dependency doesn’t appear to support a collection-file similar to the role-file to install Galaxy Collections. I posed a question on Stack Overflow but based on the documentation I’m reasonably sure the functionality doesn’t exist yet, so posting a feature request.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
greg-hellingscommented, Mar 15, 2020

PR #2609 is up. For me, at least, it supports what I need. It does not default to using the same file as the role-file argument. Prior to collections, a requirements.yml could just be a list of roles, e.g.:

- foo.bar  # This syntax will error on "ansible-galaxy collection install"
- foo.baz
- foo.yam

To install collections with ansible-galaxy you MUST indicate a collections key with appropriate names in a list. Optionally roles can be kept in the same file

collections:  # This is required for "ansible-galaxy collection install"
  - collection.foo
  - collection.bar
roles:  # This is optional and is understood by "ansible-galaxy install"
  - foo.bar
  - foo.baz

If I pointed collections at the same requirements.yml that is used for “ansible-galaxy install” calls currently, it would detect the file and could cause existing scenarios to break unnecessarily if they do not match the newer dictionary syntax.

So the PR looks, by default, for collections.yml and can be configured with the requirements-file key in your molecule.yml.

1reaction
greg-hellingscommented, Mar 12, 2020

As an update, I have code working in my local space for this. I’m working on updating unit and functional tests to accommodate the code changes I’ve made. Expect a PR within a day or two.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Galaxy User Guide - Ansible Documentation
To find collections on Galaxy: Click the Search icon in the left-hand navigation. Set the filter to collection. Set other ...
Read more >
Specify Collection dependency for Molecule - ansible
How can I inform Molecule that it needs to download a Collection for a ansible-galaxy dependency? My requirements.yml file looks like this: --- ......
Read more >
Using collections — Ansible Documentation
To search other paths for collections, use the -p option. Specify multiple search paths by separating them with a : . The list...
Read more >
Collections from Playbook - :: Ansible Labs for AnsibleFest
You can find a list of all modules and collections written by the Ansible Core Team on Ansible Galaxy. Head over there and...
Read more >
Dependency confusion in the Ansible Galaxy CLI | die-welt.net
However, I think this is not even the main problem here. The documentation says: Once a collection is found, any of its requirements...
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