I've switched to AWX for my playbooks management and I can't seem to figure out this issue with assert. Here is a role that I've prepared:
- name: Run testing environment
docker_compose:
project_name: "testing"
definition:
version: '3.7'
services:
nginx:
image: nginx:alpine
register: output
- name: save output
debug:
var: output
- name: assert that container is running
assert:
that:
- "nginx.testing_nginx_1.state.running"
When I run it with the ansible-playbook command, everything works well and the assert tasks returns the following:
TASK [test_role : assert that container is running] ************************************************************************************
ok: [testhost] => {
"changed": false,
"msg": "All assertions passed"
}
But when I run the same exact playbook using AWX, I get:
TASK [test_role : assert that container is running] ****************************
fatal: [testhost]: FAILED! => {"msg": "The conditional check 'nginx.testing_nginx_1.state.running' failed. The error was: error while evaluating conditional (nginx.testing_nginx_1.state.running): 'nginx' is undefined"}
Does anyone have an idea why this is happening?