Ansible command quotes

Question:

I would like to have the following command integrated in an Ansible playbook task:

cut -f 1 -d: /etc/passwd | xargs -n 1 -I {} bash -c ' echo -e "\n{}" ; chage -l {}'.

Any quote inside breaks the whole command. How I can avoid it to make it run the whole string?

Many thanks in advance.

Answer:

You can escape them with \”

example: "hello=\"hi\""

Leave a Reply