How Do You Fix the Ansible Problem “Failed to connect to the host via ssh: percent_expand: unknown key %C\r\n”, “unreachable”: true”?

Problem scenario 
When you run an Ansible playbook on the control node that is not running on a Mac (e.g., you are running Ansible on RedHat, Ubuntu or SUSE), you get this error: "Failed to connect to the host via ssh: percent_expand: unknown key %C\r\n", "unreachable": true".   How do you debug your playbook to get it to run?

Root cause
​The problem may not be in the playbook.   It may be in the ansible.cfg file if the ansible.cfg file was created for Ansible to work on a Mac OS. 

Solution
Find the ansible.cfg file.  Back it up.  Comment out the stanza with "ansible-ssh-%%C". This stanza is appropriate for Mac OS deployments of Ansible. 

Leave a comment

Your email address will not be published. Required fields are marked *