1 module VagrantPlugins 2 module Ansible 3 module Cap 4 module Guest 5 module POSIX 6 module AnsibleInstalled 7 8 # Check if Ansible is installed (at the given version). 9 # @return [true, false] 10 def self.ansible_installed(machine, version) 11 command = 'test -x "$(command -v ansible)"' 12 13 if !version.empty? 14 command << "&& ansible --version | grep 'ansible #{version}'" 15 end 16 17 machine.communicate.test command, sudo: false 18 end 19 20 end 21 end 22 end 23 end 24 end 25 end