-
Notifications
You must be signed in to change notification settings - Fork 664
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
Clarify the ansible collection path #3999
Comments
@ajinkyau Can you look into this? ping me if more info is needed |
@cidrblock I'm in favour of adding the |
Hi, @cidrblock and @ajinkyau! I have tried the approach @cidrblock mentioned in the comment, but it didn't work out for me. I can see that molecule was able to identify and correctly populate both the ansible.cfg and molecule.yml in the ephemeral directory, but when I run My ansible.cfg generated inside ~/.cache/molecule/extensions/default: # Molecule managed
[defaults]
ansible_managed = Ansible managed: Do NOT edit this file manually!
display_failed_stderr = True
forks = 50
retry_files_enabled = False
host_key_checking = False
nocows = 1
interpreter_python = auto_silent
collections_path = /home/r0x0d/Workspace/infra/
[ssh_connection]
scp_if_ssh = True
control_path = %(directory)s/%%h-%%p-%%r and my molecule.yml, also generated inside ~/.cache/molecule/extensions/default: # Molecule managed
---
dependency:
command: null
enabled: true
env: {}
name: galaxy
options: {}
driver:
name: vagrant
options:
managed: true
provider:
name: libvirt
safe_files: []
ssh_connection_options: []
platforms:
- box: eurolinux-vagrant/centos-7
cpus: 2
default_box: eurolinux-vagrant/centos-7
hostname: infra.convert2rhel
memory: 2048
name: instance
prerun: true
provisioner:
ansible_args: []
children: {}
config_options:
defaults:
collections_path: /home/r0x0d/Workspace/infra/
connection_options: {}
env: {}
inventory:
group_vars: {}
host_vars: {}
hosts: {}
links: {}
log: true
name: ansible
options: {}
playbooks:
cleanup: cleanup.yml
converge: converge.yml
create: create.yml
destroy: destroy.yml
prepare: prepare.yml
side_effect: side_effect.yml
verify: verify.yml
role_name_check: 0
scenario:
check_sequence:
- dependency
- cleanup
- destroy
- create
- prepare
- converge
- check
- cleanup
- destroy
cleanup_sequence:
- cleanup
converge_sequence:
- dependency
- create
- prepare
- converge
create_sequence:
- dependency
- create
- prepare
destroy_sequence:
- dependency
- cleanup
- destroy
name: default
test_sequence:
- dependency
- cleanup
- destroy
- syntax
- create
- prepare
- converge
- idempotence
- side_effect
- verify
- cleanup
- destroy
verifier:
additional_files_or_dirs: []
enabled: true
env: {}
name: ansible
options: {} |
In the getting started guide it is recommended to create an
ansible.cfg
file in the extension directory. I don't believe this is ever used.A new
ansible.cfg
file is built in each ephemeral directory and used for each step.I think the best approach here is to suggest the following entry in each scenario/molecule.yml file:
and then have the user set the ANSIBLE_COLLECTIONS_PATH environment variable at the command line prior to running molecule
We might also consider adding this to the molecule.yml file that is templated out during init.
This leaves a hard coded path out of the code, but does require the next user to set the var after cloning.
(Note: The
tox-ansible
plugin sets this environment variable for the user, so if the molecule scenarios are being run with pytest or tox this should be taken care of. This can be seen here using all three in a collection here ansible.scmFeedback welcome.
Brad
The text was updated successfully, but these errors were encountered: