Molecule: Feature request, setting no_log from playbook.yml

Created on 26 Jun 2018  路  10Comments  路  Source: ansible-community/molecule

Issue Type

  • Feature request

Molecule and Ansible details

ansible 2.5.5
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gitlab-runner/builds/54a89bc8/0/r.garrigue.ext/ansible-role-webenv/virtenv/lib/python3.6/site-packages/ansible
  executable location = /home/gitlab-runner/builds/54a89bc8/0/r.garrigue.ext/ansible-role-webenv/virtenv/bin/ansible
  python version = 3.6.5 (default, Apr 10 2018, 17:08:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

molecule, version 2.15.0

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Desired Behavior

I'ld like to be able to set no_log: false from molecule/default/playbook.yml. Debug is way too verbose for me, I just wan't to see the censored message

image

enhancement help wanted

Most helpful comment

@rgarrigue when 2.17 lands you can use this feature. Update your molecule.yml's provisioner section with:

provisioner:
  name: ansible
  log: true

All 10 comments

You are free to modify your create/destroy playbooks as you choose. However, this isn't a default we will be setting. Again, you are free to change your own setup how you see fit.

@retr0h I don't have the above mentionned playbooks in the 2.15.0 generated default scenario

image

Your soft, your call, though if there's no way to adjust verbosity I'm curious to know how you spot the issues in a debug output. As for me I can't run molecule on my windows workstation, I only have the log shown by Gitlab CI without coloration, I'm looking for "error" with firefox's Ctrl-F... not exactly efficient :-/

Let me think about this more.

I don't have the cycles to implement this. Curious if anyone else does.

@rgarrigue when 2.17 lands you can use this feature. Update your molecule.yml's provisioner section with:

provisioner:
  name: ansible
  log: true

Great, I'll test this asap, thanks !--
R茅my GARRIGUE

@retr0h I tried this right now. All good for me, though I saw one glitch

    TASK [Create Dockerfiles from image names] *************************************
    failed: [localhost] (item={'name': 'molecule-skeleton-rhel6', 'image': 'registry.access.redhat.com/rhel6:6.9'}) => {"changed": f                                                alse, "checksum": "1c9e5daeefc9b01c5e2faca80af7a70ff6c18602", "item": {"image": "registry.access.redhat.com/rhel6:6.9", "name": "mol                                                ecule-skeleton-rhel6"}, "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}
    failed: [localhost] (item={'name': 'molecule-skeleton-rhel7', 'image': 'registry.access.redhat.com/rhel7:7.4', 'privileged': Tru                                                e, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro'], 'command': '/usr/sbin/init'}) => {"changed": false, "checksum": "5a1c7daa39a0aea                                                43d343372c1e6f2e280cb4c74", "item": {"command": "/usr/sbin/init", "image": "registry.access.redhat.com/rhel7:7.4", "name": "molecule                                                -skeleton-rhel7", "privileged": true, "volumes": ["/sys/fs/cgroup:/sys/fs/cgroup:ro"]}, "msg": "Aborting, target uses selinux but py                                                thon bindings (libselinux-python) aren't installed!"}
    failed: [localhost] (item={'name': 'molecule-skeleton-centos7', 'image': 'centos:7', 'privileged': True, 'volumes': ['/sys/fs/cg                                                roup:/sys/fs/cgroup:ro'], 'command': '/usr/sbin/init'}) => {"changed": false, "checksum": "909beb3571163bdae16f6b9eb998b0a17d67fbab"                                                , "item": {"command": "/usr/sbin/init", "image": "centos:7", "name": "molecule-skeleton-centos7", "privileged": true, "volumes": ["/                                                sys/fs/cgroup:/sys/fs/cgroup:ro"]}, "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"                                                }
    fatal: [localhost]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for th                                                is result", "changed": false}

The last message shouldn't be here, though I dunno if it's a task not taking in account the no_log or something else.

Not sure thats something Molecule controls... Everywhere that references no_log has been changed.

[jodewey:~/git/molecule_2] [molecule2-env-2.7.13] master+ 卤 ag no_log: | grep -v molecule_yml.provisioner.log
[jodewey:~/git/molecule_2] [molecule2-env-2.7.13] master+ 1 卤

To my surprise, only discovered that adding log: true to root level in molecule does not also activates it for the provisioner. I am not sure if this is by design or a bug, but I clearly find it confusing, especially as docker provisioning failures are very common with ansible.

What about turning no_log: "{{ molecule_no_log }}" to no_log: "false" in create.yml file? Worked for me

Was this page helpful?
0 / 5 - 0 ratings