我试图运行一个剧本并获得如下语法错误,需要了解我的错误在哪里:错误!相互冲突的行动陈述
错误似乎出现在'/etc/ansible/chk_ddboost.yml'中:第4行第7行,但可能 取决于确切的语法问题,在文件的其他位置。
tasks:
- name: ddboost plugin check
^ here
---
- hosts: netbackup
tasks:
- name: ddboost plugin check
stat:
path: /usr/openv/lib/ost-plugins/libstspiDataDomain.so
register: stat_result
fail: msg="DDBoost not installed on system"
when: stat_result.stat.exists = False
- name: run command as root
become: true
become_method: sudo
become_user: root
command: "/usr/openv/netbackup/bin/admincmd/bpstsinfo -pi -stype DataDomain"
- name: show output
debug: msg="{{result.stdout_lines}}"
答案 0 :(得分:0)
缺少破折号:
- name: ddboost plugin check
stat:
path: /usr/openv/lib/ost-plugins/libstspiDataDomain.so
register: stat_result
- fail: msg="DDBoost not installed on system"
when: not stat_result.stat.exists = False
答案 1 :(得分:0)
缩进级别不正确。 -name:
块应在-tasks
下缩进一级。
您有:
- hosts: netbackup
tasks:
- name: ddboost plugin check
...
您应该具有:
- hosts: netbackup
tasks:
- name: ddboost plugin check
...