>> Is there a way to access it from outside the run of the playbook, like
>> we do --list-tasks.
> There's not.
Well, at least I can stop searching :)
>> My use case is testing the play books with spec and serverspec.
>> I'd like my test suit to be automated:
>> "for a given host, here is the list of roles that have been applied,
>> test each of them".
>
> Nope. Though you could --list-tasks and parse out the role names, I
> guess, or even write a playbook that walked the list of things and generated
> a config file.
IIRC, list-tasks doesn't output the role names, only the targeted group.
This would be a simple solution to this need, though.
Calling a play to generate it might work. I'll try.
> I am generally of the opinion that a need for server-spec to verify that
> Ansible set basic things like file permissions correctly is a sign that
> Ansible *does not work* (which it does) and that it's easier to just call a
> test script as the last per-host action in your playbook, so that the
> playbook returns a proper failure code and fails the host. What should be
> tested is whether the application is running, not that there are 1:1 tests
> for every step in the playbook -- which is a crazy large amount of extra
> work for not much more value add. But that's me giving a public service
> announcement and everyone is welcome to do what they want :)
I completely agree.
We look for other things in our test:
- good integration of all the pieces: more service level than app
- no regression: there are 5 of us committing regularly, on several
different configs for very different client setups
- human error
It also brings a better overall understanding and forces to ask
questions differently.
But we are not testing Ansible itself, as you said, it knows how to
set permissions on a file :)
Thanks again.
raphael.
>
https://groups.google.com/d/msgid/ansible-project/CAEVJ8QMR5f8OQbtWKA8KAVh%2Brm2_zQsuu64mpebm_JDOKCyRdA%40mail.gmail.com.