【发布时间】:2017-01-14 02:16:45
【问题描述】:
我在 Ansible 脚本中有以下行:
- name: get UUID
shell: "blkid | grep test--tgroup* | grep xfs | awk -F : '{print "blkid -s UUID -o value "$1}' |sh"
register: UUID_value
运行脚本时出现以下错误:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/etc/ansible/config/test.yml': line...
May be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
shell: "blkid | grep test--tgroup* | grep xfs | awk -F : '{print "blkid -s UUID -o value "$1}' |sh"
^ here
谁能告诉我如何解决这个语法问题?
【问题讨论】:
-
看起来您只需要转义嵌入的引号。