"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/plugins/provisioners/ansible/cap/guest/alpine/ansible_install.rb" (20 Nov 2020, 1649 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 Alpine
    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                   ansible_apk_install machine
   21               end
   22             end
   23 
   24             private
   25 
   26             def self.ansible_apk_install(machine)
   27               machine.communicate.sudo "apk add --update --no-cache python3 ansible"
   28               machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
   29               machine.communicate.sudo "if [ ! -e /usr/bin/pip ]; then ln -sf pip3 /usr/bin/pip ; fi"
   30             end
   31 
   32             def self.pip_setup(machine, pip_install_cmd = "")
   33               machine.communicate.sudo "apk add --update --no-cache python3"
   34               machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
   35               machine.communicate.sudo "apk add --update --no-cache --virtual .build-deps python3-dev libffi-dev openssl-dev build-base"
   36               Pip::get_pip machine, pip_install_cmd
   37             end
   38 
   39           end
   40         end
   41       end
   42     end
   43   end
   44 end