plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb in vagrant-unbundled-2.3.3.0 vs plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb in vagrant-unbundled-2.3.6.0
- old
+ new
@@ -8,11 +8,11 @@
# Check if Ansible is installed (at the given version).
# @return [true, false]
def self.ansible_installed(machine, version)
command = 'test -x "$(command -v ansible)"'
- if !version.empty?
- command << "&& ansible --version | grep 'ansible #{version}'"
+ unless version.empty?
+ command << "&& [[ $(python3 -c \"import importlib.metadata; print(importlib.metadata.version('ansible'))\") == \"#{version}\" ]]"
end
machine.communicate.test command, sudo: false
end