How Do You Troubleshoot the Ansible Playbook Error Associated with “[Errno 2] No such file or directory”?

Problem scenario
When running an Ansible playbook using the java_cert module you receive an message "[Errno 2] No such file or directory". How do you fix this?
(If you were using a file linking step in the playbook and not the java_cert module, see this posting.)

Use the "executable" attribute of the java_certs module ( to specify the full path of the keytool file. It may be that you have Java installed, but the keytool file is in a location that is not part of the environment variables of the OS. To find where the keytool is, log on to the managed node. Run this command: sudo find / -name keytool
The above location (the result of the command above) should be the value of the "executable" attribute underneath the java_cert module.

Leave a comment

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