4
この質問に以前に回答した場合は、事前に謝罪してください。私は広範な検索を実行し、私の基準を満たす既存のソリューションを見つけることができませんでした。アシスタント:stdoutの値に基づいて非同期タスクでfailed_whenを実行してください。
failed_when:
は、stdoutの値に基づいて非同期タスクで実行しようとしています。
これが私の仕事です:私は、タスクの状態を確認し、指定したテキストが標準出力にあるとき、それは失敗したいところ
- name: RUN SOME TASK LOCALLY
command: <run_some_script_here>.sh
chdir=/task_folder/
delegate_to: localhost
register: task_status
async: 3600
poll: 0
です。
- name: CHECK TASK PROGRESS
async_status: jid={{ task_status.ansible_job_id }}
register: poll_status
until: poll_status.finished
retries: 100
failed_when: "'ERROR. TASK FAILED.' in poll_status.stdout"
私はAnsible
TASK [CHECK TASK PROGRESS] *************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check ''ERROR. TASK FAILED.' in poll_status.stdout' failed. The error was: error while evaluating conditional ('ERROR. TASK FAILED.' in poll_status.stdout): Unable to look up a name or access an attribute in template string ({% if 'ERROR. TASK FAILED.' in poll_status.stdout %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like '-': argument of type 'StrictUndefined' is not iterable"}
事前に感謝しますから、次のエラーに直面しています上記の脚本を実行します。
ありがとうございます。それは働いた:) –