Thanks, I’d also missed this, I think it could replace all of my uses of stat apart from the ones that need to check where a symlink points to or the checksum of a file.
Testing against a remote host where I know test.yml doesn’t exist returns the same results though, so this appears to be a controller test, not a remote test. Unless I’m missing something, stat would still be required to test against remote inventory.
$ ansible testhost -m command -a "echo {{ 'test.yml' is exists }}"
testhost | CHANGED | rc=0 >>
True
$ ansible testhost -m stat -a "path=test.yml"
testhost | SUCCESS => {
"changed": false,
"stat": {
"exists": false
}
}
Tests, not filters. Filters are used with | (or map()) and are used to transform data in some way; tests are used with is (or select() etc.) and return true or false depending on whether the data passes the test.