0

I'm getting the following error on

==> default: Configuring cache buckets...
==> default: Running provisioner: ansible... 

The executable 'ansible-playbook' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

I'm using vagrant-cachier plugin for composer vendor caching and ansible is installed. What could be the problem?

Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90
3ND
  • 430
  • 1
  • 6
  • 17
  • please post the `config.vm.provision` section of your Vagrantfile and explain where your playbook is located. – tedder42 May 17 '15 at 16:27
  • when the machine comes up (provisioning failure should leave it running) can you ssh to the machine and run 'ansible-playbook' manually? – antweiss May 18 '15 at 07:21
  • You need to have Ansible installed on the host to be able to use the built-in Ansible provisioner. What's your host OS and do you have Ansible installed? – ydaetskcoR May 18 '15 at 12:27

1 Answers1

1

As @ydaetskcoR said, you're missing Ansible on the host machine. Alternatively, you can run the playbooks locally, but the provisioner that ships with Vagrant doesn't support that, so you'll have to do it with a shell provisioner:

config.vm.synced_folder "ansible", "/opt/ansible"

config.vm.provision "ansible", type: "shell" do |s|
  s.inline = <<SCRIPT
    hash ansible-playbook &> /dev/null
    if [ $? -eq 0 ]; then
      echo Ansible already installed.
    else
      echo $(date +"%T"): Updating APT database.
      apt-get update &> /dev/null
      echo $(date +"%T"): Installing Python and pip.
      apt-get -y install python-pip python-dev &> /dev/null
      echo $(date +"%T"): Installing Ansible via pip.
      pip install ansible &> /dev/null
    fi
    mkdir -p /etc/ansible
    hostname > /etc/ansible/hosts
    echo $(date +"%T"): Executing Ansible playbook.
    ansible-playbook /opt/ansible/playbook.yml --connection=local
SCRIPT
end
Nathan Hoover
  • 636
  • 3
  • 5