
プレイブックの管理に AWX に切り替えましたが、アサートに関するこの問題を解決できないようです。準備したロールは次のとおりです。
- 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 コマンドで実行すると、すべて正常に動作し、アサート タスクは以下を返します。
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"}
なぜこのようなことが起こるのか、誰か分かるでしょうか?