I have a rather simple ansible adhoc command using shell to run chfn:
ansible all -i ./inventory/all -s -K -m shell -a 'chfn -f "$HOSTNAME root" root'
chfn needs the double quotes, and I've tried several different ways to escape them with no luck. I've tried wrapping the shell command in double quotes and single quotes, and using / to escape the double quotes and tried single quotes as well. Running chfn -f "$HOSTNAME root" root
works just fine but I can't figure out how to get ansible to run it this way. (I know it's an option, but I'd rather not turn it into a shell script and run it that way via ansible if possible)