LoginSignup
1
1

More than 5 years have passed since last update.

Failed to find required executable git

Posted at

再現手順

sudo でrootユーザーの実行権限で、次のようなplaybookを実行したら発生する。

playbook.yml
- hosts: localhost
  connection: local
  tasks:
  - name: clone github repos
    tags: github
    sudo: no
    git:
      repo: https://github.com/cubicdaiya/slackboard.git
      dest: $HOME/slackboard

現象

次のようなエラーが発生してリポジトリをCloneできない。

TASK [clone github repos] ******************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find required executable git"}

原因

sudoで実行するrootユーザーに、gitのPATHが通っていないため、gitが実行できない。

対応方法

昔は、sudo=no をtaskに指定すればよかったが、Ansible 1.9 から非推奨になっている。

[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default).

becomを使うことが推奨されている。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1