:使用ansible shell模块的grep命令中的字符错误
我试图在json文件中找到某个键值对,但ansible似乎不喜欢:字符。。。 我试图逃离所有的角色,但没有成功。。。知道我做错了什么吗:使用ansible shell模块的grep命令中的字符错误,shell,ansible,Shell,Ansible,我试图在json文件中找到某个键值对,但ansible似乎不喜欢:字符。。。 我试图逃离所有的角色,但没有成功。。。知道我做错了什么吗 - name: Check if file contains the entry KEY VAL shell: cat PATH/dummy_file.file | grep "\"KEY\": \"VAL\"" become: yes become_method: sudo failed_when: false register: cat
- name: Check if file contains the entry KEY VAL
shell: cat PATH/dummy_file.file | grep "\"KEY\": \"VAL\""
become: yes
become_method: sudo
failed_when: false
register: cat_result
引用整个壳牌系列:
shell: 'cat PATH/dummy_file.file | grep "\"KEY\": \"VAL\""'