Molecule need to log the same way ansible does
See original GitHub issueIssue Type
- Feature request
Molecule and Ansible details
ansible --version && molecule --version
Molecule installation method (one of):
- pip
Ansible installation method (one of):
- pip
Desired Behavior
It could sound as a joke, but molecule need to have the same bugs as ansible. Why we need this ? For example i spend some time to write an ansible role for influxdb Since the module influxdb_user in the ansible core doesn’t behave as I want, i decided to include a custom module in my role and use molecule for every role i write. All went well, my custom module works and is taking over the core module and molecule return OK My CI report a success too
Now my role seems ok, i include it in a playbook and run it and…
TASK [influxdb : [InfluxDB] Create users] ******************************************************************************************************************************************************************
failed: [canoctl_influxdb1] (item={u'user_password': u'[redacted]', u'grants': [{u'privilege': u'ALL', u'database': u'[redacted]'}], u'user_name': u'[redacted]'}) => {"changed": false, "item": {"grants": [{"database": "[redacted]", "privilege": "ALL"}], "user_name": "[redacted]", "user_password": "[redacted]"}, "msg": "Unsupported parameters for (influxdb_user) module: grants Supported parameters include: ********, hostname, password, port, proxies, retries, ssl, state, timeout, udp_port, use_udp, user_name, user_password, username, validate_certs"}
It wasn’t clear at first why it doesn’t works and banging my head a few hours before finding this issue #ansible/ansible/issues/17078
The reason of this bug is obscure and the issue is old but it is clear that molecule use some configuration who allow in his way to bypass this bug.
You will find at least 2 examples in the issue, one is a minimal example of my use case ( creation of docker_containers, then apply my role on them ) who cause the error above but works smoothly on my molecule scenario.
Hope you will find some solution to stick close to the ansible bugs to not let your users believe their roles are ok and publish them on ansible galaxy without them noticing than they are buggy :p
Best regards,
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
@decentral1se , you will find here a reproducible test case who show no errors with molecule but throw one in a similar case without molecule.
test-ko.yml playbook:
test-ok.yml playbook: (just removed the creation of the container)
Test with molecule is ok with different version of ansible
From a discussion with @agaffney on IRC, he think that molecule use an alternate ansible.cfg who add some path to “library” and is the reason for why molecule doesn’t hit this bug. On Ansible side, I didn’t dig in the source code to fully understanding it, but from the issue, it seems that this error is triggered when a core module (even if not related with the custom one) was used with “name” arg before the custom one but is not always the case. NB: this error only happen when the custom module have the same name as the core module. In my example, the module “add_host” use an arg “name” but doesn’t trigger the error when the use of “docker_container” (who have a “name” arg) trigger the error. In @alikins repro example it seems that it is the “name” of the task who trigger the error since “debug” doesn’t have a “name” arg.
So pragmatically, the reasons who seems to trigger the error don’t seem to be related to an ansible.cfg configuration from my point of view, but despite that, it is clear that my role works fine with molecule (with last 2.5,2.6,2.7) when it didn’t work when using directly with a bare ansible without specific path configuration. (tested with last 2.5, 2.6, 2.7)