The point was that a lot of people think server_spec is somehow required to test “behind” Ansible to see what it did what it said it did.
It’s not.
The reason is because this is the whole purpose of a configuration management system - to say “the state shall be X” and make it so.
Thus what you really want to do is run integration tests.
In Ansible, especially in doing a rolling update, calling a test script prior to your “post_tasks” section where you add something back to a load balancer is a GREAT way to make sure failed nodes don’t hop back in. (set max_failed_percentage: X first to choose how many nodes can fail before the update is stopped).
assert, wait_for, script, and stat all make good modules to drive some basic testing.
I definitely would disagree that anyone would have to look at infrastructure like code, that’s the whole point of Ansible is saying this is over complication.
Ansible playbooks aren’t code, they are more lists of things that should be done, or true, in order.
The best way of testing is often just to do a full playbook run against a stage environment, and then run your test battery against that stage environment.
That is often going to be something a lot more involved that your QA team might write - check to make sure the app actually works, rather than what server_spec does, which is usually (in all examples I’ve seen) usually weak stuff like “is this port open”. Which doesn’t prove your app actually works – and has the added overhead of (A) being a different language (B) being a duplication of effort, etc.
I owe a blog post on this, which I hope to get done this week. TBD.
So, that’s not saying no to testing, but it’s saying no to writing tests that are a mirror of the low level descriptions of your infrastructure that you already wrote playbooks for.
Integration testing is where it’s at, and having ansible playbooks call those – especially in a rolling update – is a GREAT idea, since ansible is a fail-fast system and it will show up in your server report at the bottom.
There are some systems that will keep configuring as much as you can, but Ansible’s going to raise it to your attention and make you fix it