"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb" (20 Nov 2020, 1327 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 require_relative "../facts"
    2 require_relative "../pip/pip"
    3 
    4 module VagrantPlugins
    5   module Ansible
    6     module Cap
    7       module Guest
    8         module Fedora
    9           module AnsibleInstall
   10 
   11             def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
   12               case install_mode
   13               when :pip
   14                 pip_setup machine, pip_install_cmd
   15                 Pip::pip_install machine, "ansible", ansible_version, pip_args, true
   16               when :pip_args_only
   17                 pip_setup machine, pip_install_cmd
   18                 Pip::pip_install machine, "", "", pip_args, false
   19               else
   20                 rpm_package_manager = Facts::rpm_package_manager(machine)
   21 
   22                 machine.communicate.sudo "#{rpm_package_manager} -y install ansible"
   23               end
   24             end
   25 
   26             private
   27 
   28             def self.pip_setup(machine, pip_install_cmd = "")
   29               rpm_package_manager = Facts::rpm_package_manager(machine)
   30 
   31               machine.communicate.sudo "#{rpm_package_manager} install -y curl gcc gmp-devel libffi-devel openssl-devel python-crypto python-devel python-dnf python-setuptools redhat-rpm-config"
   32               Pip::get_pip machine, pip_install_cmd
   33             end
   34 
   35           end
   36         end
   37       end
   38     end
   39   end
   40 end