"Failed to find required executable git" when using launch daemon to run ansible-pull

898 views
Skip to first unread message

Ye Na Rhee

unread,
Aug 27, 2015, 5:58:00 AM8/27/15
to Ansible Project
I'm getting these errors when I set launch daemon to run ansible-pull, and it works well when I run the script directly in terminal.

Starting ansible-pull at 2015-08-27 11:46:47
localhost | FAILED >> {
    "failed": true, 
    "msg": "Failed to find required executable git"
}


The launchd file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.myprogram.ansiblepull</string>
    <key>ProgramArguments</key>
    <array>
    <string>{{ workdir }}/ansible-pull.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>600</integer>
    
    <key>RunAtLoad</key>
    <true/>

    <key>StandardOutPath</key>
    <string>/var/ansible/log/ansiblepull.out</string>
    <key>StandardErrorPath</key>
    <string>/var/ansible/log/ansiblepull.err</string>

</dict>
</plist>

The path to git is /usr/local/bin/git.

Thanks in advance!

Ye Na Rhee

unread,
Aug 27, 2015, 6:19:34 AM8/27/15
to Ansible Project
I solved it by including the PATH variable in the launchd file:
    <key>EnvironmentVariables</key>
    <dict>
    <key>PATH</key>
    <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
    </dict>
Reply all
Reply to author
Forward
0 new messages