0

When testing an ansible role using molecule tool and verifying the result with testinfra(pytest), I am not able to print or debug certain output or an ansible variable.

============================= test session starts ==============================
platform linux2 -- Python 2.7.5, pytest-4.6.6, py-1.8.0, pluggy-0.13.0 -- /root/test1/myenv/bin/python2
using: pytest-4.6.6 pylib-1.8.0
setuptools registered plugins:
  testinfra-3.2.1 at /root/test1/myenv/lib/python2.7/site-packages/testinfra/plugin.py
rootdir: /root/test1/server_manager/molecule/default
plugins: testinfra-3.2.1
collected 1 item

tests/test_default.py::test_Ansible_variable[ansible://instance] PASSED  [100%]

=========================== 1 passed in 3.29 seconds ===========================

Is there is a way to do that?

zegoat7
  • 457
  • 1
  • 6
  • 14

1 Answers1

1

Under the testinfra verifier component in molecule.yml file, enable the 's' option. For example:

---
dependency:
  name: galaxy
driver:
  name: docker
lint:
  name: yamllint
platforms:
  - name: instance
    image: centos:7
provisioner:
  name: ansible
  lint:
    name: ansible-lint
verifier:
  name: testinfra
  lint:
    name: flake8
  options:
    s: true
zegoat7
  • 457
  • 1
  • 6
  • 14