
플레이북 관리를 위해 AWX로 전환했는데 Assert를 사용하여 이 문제를 해결할 수 없는 것 같습니다. 제가 준비한 역할은 다음과 같습니다.
- 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"
ansible-playbook 명령을 사용하여 실행하면 모든 것이 잘 작동하고 Assert 작업이 다음을 반환합니다.
TASK [test_role : assert that container is running] ************************************************************************************
ok: [testhost] => {
"changed": false,
"msg": "All assertions passed"
}
하지만 AWX를 사용하여 똑같은 플레이북을 실행하면 다음과 같은 결과가 나타납니다.
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"}
왜 이런 일이 일어나는지 아는 사람이 있나요?