"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb" (20 Nov 2020, 610 Bytes) of package /linux/misc/vagrant-2.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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