Ansible command-task runs into "Exec format error"
If the thing you're trying to run is a shell script, check:
-
That it isn't missing a shebang line at the top like:
#!/usr/bin/env bash
- That the user ansible will run as has execute permissions for it (e.g. mode
0755
)
In general, 'exec format error' in ansible can mean:
- a program you gave ansible to execute is, literally, not an executable.
- ansible has found a file marked as an executable, which is not really executable, and tried to execute it.
In other words: It almost always means permissions are incorrect, but it can happen in both directions (underprivileged or overprivileged files can cause exec errors in different ways).
Personally, I have found that I get such an error when I do things like "chmod 777 /etc/ansible/facts/.." on certain directories and so on.