"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb" (20 Nov 2020, 1776 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 "../pip/pip"
    2 
    3 module VagrantPlugins
    4   module Ansible
    5     module Cap
    6       module Guest
    7         module Debian
    8           module AnsibleInstall
    9 
   10             def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
   11               case install_mode
   12               when :pip
   13                 pip_setup machine, pip_install_cmd
   14                 Pip::pip_install machine, "ansible", ansible_version, pip_args, true
   15               when :pip_args_only
   16                 pip_setup machine, pip_install_cmd
   17                 Pip::pip_install machine, "", "", pip_args, false
   18               else
   19                 ansible_apt_install machine
   20               end
   21             end
   22 
   23             private
   24 
   25             def self.ansible_apt_install(machine)
   26 install_backports_if_wheezy_release = <<INLINE_CRIPT
   27 CODENAME=`lsb_release -cs`
   28 if [ x$CODENAME == 'xwheezy' ]; then
   29   echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports.list
   30 fi
   31 INLINE_CRIPT
   32 
   33               machine.communicate.sudo install_backports_if_wheezy_release
   34               machine.communicate.sudo "apt-get update -y -qq"
   35               machine.communicate.sudo "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" ansible"
   36             end
   37 
   38             def self.pip_setup(machine, pip_install_cmd = "")
   39               machine.communicate.sudo "apt-get update -y -qq"
   40               machine.communicate.sudo "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" build-essential curl git libssl-dev libffi-dev python-dev"
   41               Pip::get_pip machine, pip_install_cmd
   42             end
   43 
   44           end
   45         end
   46       end
   47     end
   48   end
   49 end