Open hluaces opened 3 years ago
I do not remember removing such a feature myself and I am inclined to believe that we should just remove it from the docs. Having an yaml option vvv
does not make any sense to me, what about 1, 2, 3, or 5 v's? ;)
Just in case my original issue wasn't clear: the docs mention vvv
but v
, vv
, ... all worked as expected.
IMHO removing it seems fine but it should be acknowledged that it won't work in the docs to prevent people from trying to figure out why it doesn't.
I think this feature is very useful. Not sure why it has been removed, but I don't think it should be. When you use the ANSIBLE_VERBOSITY
environment variable, you actually end up getting all molecule phases outputting at that verbosity level rather than just the provisioner phases.
Have you tried using one of the following options and see if it fits for your use case?
molecule -vvv converge ...
).molecule converge -- -vvv
).Hi @hluaces, I'm using molecule test
instead of molecule converge
. The first option you proposed has the same effect as using ANSIBLE_VERBOSITY=3
while the second doesn't work with molecule test
.
I'm not able to get molecule to pass ANY amount of -v
to ansible-playbook
using any techniques mentioned:
-vvv
or --debug
to molecule
provisioner:
name: ansible
options:
vvv: True
ANSIBLE_VERBOSITY=3
env var.Some of these make molecule more verbose, but the call to the converge.yml playbook is still the vanilla:
ansible-playbook --inventory /home/tim/.cache/molecule/ansible/deb10-headless/inventory --skip-tags molecule-notest,notest /home/tim/src/timblaktu-cm/ansible/molecule/deb10-headless/converge.yml
Trying to troubleshoot an ansible issue within molecule and not getting enough info..
Also faced the same problem, passing env to provisioner
seems to work fine:
...
provisioner:
name: ansible
env:
ANSIBLE_VERBOSITY: 3
...
I have tried everything is this issue report and nothing works.
Many of the options listed here will result in a jinja2 exception:
Run molecule test -s myscenario
WARNING Driver docker does not provide a schema.
INFO myscenario scenario test matrix: dependency, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO Performing prerun with role_name_check=0...
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.14/x64/bin/molecule", line 8, in <module>
sys.exit(main())
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/command/test.py", line 110, in test
base.execute_cmdline_scenarios(scenario_name, args, command_args, ansible_args)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/command/base.py", line 146, in execute_cmdline_scenarios
execute_scenario(scenario)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/command/base.py", line 1[9]()7, in execute_scenario
execute_subcommand(scenario.config, action)
File "/opt/hostedtoolcache/Python/3.[10]().14/x64/lib/python3.10/site-packages/molecule/command/base.py", line 187, in execute_subcommand
return command(current_config).execute(args)
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/command/base.py", line 71, in __init__
self._setup()
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/command/base.py", line 93, in _setup
self._config.provisioner.write_config()
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/provisioner/ansible.py", line 771, in write_config
template = util.render_template( # type: ignore[no-untyped-call]
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/molecule/util.py", line 188, in render_template
return t.render(kwargs) # type: ignore[attr-defined]
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/jinja2/environment.py", line [13]()04, in render
self.environment.handle_exception()
File "/opt/hostedtoolcache/Python/3.10.[14]()/x64/lib/python3.10/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 3, in top-level template code
File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/jinja2/utils.py", line 83, in from_obj
if hasattr(obj, "jinja_pass_arg"):
jinja2.exceptions.UndefinedError: 'bool object' has no attribute 'items'
Error: Process completed with exit code 1.
Apologies if this is working as intended. I've tried to search for it but didn't see anywhere that this was a deprecation change.
Specifying the
vvv: true
option on the provider section of amolecule.yml
has no effect even whenmolecule
is ran with or without the--debug
flag.The documentation, under the section which explains how to override playbook files, shows the following snippet:
Using
vvv: True
has no effect. Usingvvv: true
also has no effect. This used to work on previous molecule versions (3.0.x if I recall correctly).I'm aware that there are alternatives, such as:
molecule
command (molecule -vvv converge ...
).molecule converge -- -vvv
).ANSIBLE_VERBOSITY: '3'
).I'm opening this issue just to clarify wether this is an intentional change or not. In case it is I guess that that documentation should be fixed.
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
Ansible installation method (one of):
Detail any linters or test runners used:
Desired Behavior
Either the documentation should not provide examples with the
vv
option and say that option does not work or specifying the optionsv
,vv
orvvv
, ... in the molecule file should pass the desired verbosity to theansible-playbook
command.Actual Behaviour
ansible-playbook
is ran without verbosity (the-vvv
parameter).There's a minimum complete verifiable example in this repo.
This is the output of a
molecule --debug converge
with thevvv: true
option set (note that no-vvv
flag is passed toansible-playbook
):