escaping in a shell module

Hi,

ansible 2.4.0
remote environment: ubuntu 14.04
host/controller: Ubuntu 16.04.7 LTS

I have a task to extract some usernames from the passwd file

- name: extract usernames from password file
shell: “awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) && ($6=”/sftp")’ /etc/passwd > /home/xxxxxxxx/migrate/passwd.mig"

However, I am not sure why ansible is complaining when I run the above command.

When I run the awk command on the server CLI it runs fine. I have even tried escaping “/sftp” with a \ but then awk complains so not sure how to g about it.

Thanks

Danish

Thanks everyone, got this working.

awk -v LIMIT=$UGIDLIMIT -F’:’ ‘($3>=LIMIT) && ($3!=65534) && ($6==“/sftp”)’ /etc/passwd > /home/ xxxxxxxx /migrate/passwd.mig