是否有一些Ansible等效于"failed_when"?为了成功 [英] Is there some Ansible equivalent to "failed_when" for success

查看:197
本文介绍了是否有一些Ansible等效于"failed_when"?为了成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看有关错误处理的文档可用的错误处理

Looking at the documentation about error handling Ansible error handling

我只想知道一种失败的配置方法fail_when,我想知道是否有任何方法可以做相反的事情.

I only see a way to fail the provisioning fail_when, i am wondering if there is any way to do the oposite.

看起来像这样的东西:

- name: ping pong redis
  command: redis-cli ping
  register: command_result
  success_when: "'PONG' in command_result.stderr"

谢谢.

推荐答案

我认为声明模块是您想要的.

1.5版的新功能

New in version 1.5

示例:

- assert: { that: "ansible_os_family != 'RedHat'" }

这篇关于是否有一些Ansible等效于"failed_when"?为了成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆