Reputation: 436
Im trying to find a certain key value pair in a json file but ansible doesn't seem to like the : character... I tried escaping all the characters without success... any idea on what I'm doing wrong?
- 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
Upvotes: 0
Views: 162
Reputation: 141768
Quote the whole shell line:
shell: 'cat PATH/dummy_file.file | grep "\"KEY\": \"VAL\""'
Upvotes: 1