molecule icon indicating copy to clipboard operation
molecule copied to clipboard

The dependency and provisioner stages execute from different locations

Open minsis opened this issue 9 months ago • 1 comments

Prerequisites

  • [x] This was not already reported in the past (duplicate check)
  • [x] It does reproduce it with code from main branch (latest unreleased version)
  • [x] I include a minimal example for reproducing the bug
  • [x] The bug is not trivial, as for those a direct pull-request is preferred
  • [x] Running pip check does not report any conflicts
  • [x] I was able to reproduce the issue on a different machine
  • [x] 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 azure:23.7.0 from molecule_plugins vagrant:23.7.0 from molecule_plugins default:25.4.0 from molecule podman:23.7.0 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0 containers:23.7.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1 ec2:23.7.0 from molecule_plugins gce:23.7.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0 openstack:23.7.0 from molecule_plugins requiring collections: openstack.cloud>=2.1.0 docker:23.7.0 from molecule_plugins requiring collections: community.docker>=3.10.2 ansible.posix>=1.4.0

What happened

When referencing directories for the dependency stage they are not valid for the provisioner stage. In my example you can see I set collection-path to ../.ansible/collections but for the provision stage it has to be set to ../../../.ansible/collections

Also, even within its own execution it references different directories, as you can see with requirements-file set to ./collection.yml.

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

minsis avatar Apr 11 '25 17:04 minsis

This appears to be a valid bug. Thanks @minsis, we will look further into this.

alisonlhart avatar May 28 '25 12:05 alisonlhart