Skip to content

The dependency options are not universal when galaxy is using collections vs roles #4427

@minsis

Description

@minsis

Prerequisites

  • This was not already reported in the past (duplicate check)
  • It does reproduce it with code from main branch (latest unreleased version)
  • I include a minimal example for reproducing the bug
  • The bug is not trivial, as for those a direct pull-request is preferred
  • Running pip check does not report any conflicts
  • I was able to reproduce the issue on a different machine
  • The issue is not specific to any driver other than 'default' one

Environment

molecule 25.4.0 using python 3.13
ansible:2.18.3
gce:23.7.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
default:25.4.0 from molecule
containers:23.7.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
vagrant:23.7.0 from molecule_plugins
openstack:23.7.0 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
podman:23.7.0 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
azure:23.7.0 from molecule_plugins
ec2:23.7.0 from molecule_plugins
docker:23.7.0 from molecule_plugins requiring collections: community.docker>=3.10.2 ansible.posix>=1.4.0

What happened

If you have to specifiy ansible-galaxy options in the dependency stage, the options are passed to both collection and role commands. For example, If I set --collections-path option and provide both requirements.yml and collections.yml files, then the dependency stage applies --collections-path to ansible-galaxy role install, in which this option does not exist for role installs.

Reproducing example

dependency:
  name: "galaxy"
  options:
    force: true
    collections-path: ../.ansible/collections
    requirements-file: ./collections.yml

driver:
  name: "docker"

provisioner:
  name: "ansible"
  playbooks:
    prepare: ../default/prepare.yml
    converge: ../default/converge.yml
    verify: ../default/verify.yml
  connection_options:
    ansible_become: true
  env:
    ANSIBLE_COLLECTIONS_PATH: ../../../.ansible/collections

verifier:
  name: "ansible"

platforms:
  - name: "molecule-rhel8"
    image: registry.redhat.io/ubi8/ubi:latest
    privileged: true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions