Is anyone using molecule/testinfra to test real infrastructure (verifying things ansible has managed)? The unit testing of playbooks is awesome but how would I use the framework to test real things on real systems?
You wouldn’t.
You’re supposed to test things before you deploy them.
You can use Ansible itself for testing 'existing state':
- use unprivileged users so any 'change' would fail and that failure
would tell you it is not the expected state. i.e service: name=apache
state=started
- check mode/diff are also helpful when combined with assert/fail
- it is good to model it in a TDD form, have one person create the
playbook the sets the state, another one that verifies the state, this
requires a good spec on 'expected state'
It should be simple for QA to audit and map the tasks and plays to the
test cases.