无法在ansible中使用条件语句

时间:2019-12-26 15:58:20

标签: ansible

enter image description here

我无法使用条件语句

- name: check the status
  shell: "service httpd status"
  changed_when: False
  register: test
  failed_when: test.rc not in [0,4]


- name: display the message
  debug:
    msg: "the output {{test}}"

- name: git download package
  yum:
    name: httpd
    state: present
  failed_when: test.rc not in [0,4]

我遇到以下错误:如何解决该问题

致命:[10.43.20.55]:失败! => {“ changed”:false,“ msg”:“(yum)模块不支持的参数:failed_when支持的参数包括:allow_downgrade,autoremove,bugfix,conf_file,disable_excludes,disable_gpg_check,disable_plugin,disablerepo,download_dir,download_only,enable_plugin,< / p>

0 个答案:

没有答案