Merge pull request #6649 from rickard-von-essen:issue-6636
Close #6636 Note that there is no CHANGELOG entry for this bug fix, since the `ansible_local` provisioner [#2103] has not been released yet.
This commit is contained in:
commit
a8d0c225c6
|
@ -1,39 +0,0 @@
|
||||||
|
|
||||||
module VagrantPlugins
|
|
||||||
module Ansible
|
|
||||||
module Cap
|
|
||||||
module Guest
|
|
||||||
module EPEL # Extra Packages for Enterprise Linux (for RedHat-family distributions)
|
|
||||||
module AnsibleInstall
|
|
||||||
|
|
||||||
# This should work on recent Fedora releases, and any other members of the
|
|
||||||
# RedHat family which supports YUM and http://fedoraproject.org/wiki/EPEL
|
|
||||||
def self.ansible_install(machine)
|
|
||||||
|
|
||||||
configure_epel = <<INLINE_CRIPT
|
|
||||||
cat <<EOM >/etc/yum.repos.d/epel-bootstrap.repo
|
|
||||||
[epel]
|
|
||||||
name=Bootstrap EPEL
|
|
||||||
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-\$releasever&arch=\$basearch
|
|
||||||
failovermethod=priority
|
|
||||||
enabled=0
|
|
||||||
gpgcheck=0
|
|
||||||
EOM
|
|
||||||
|
|
||||||
yum --assumeyes --quiet --enablerepo=epel install epel-release
|
|
||||||
rm -f /etc/yum.repos.d/epel-bootstrap.repo
|
|
||||||
INLINE_CRIPT
|
|
||||||
|
|
||||||
ansible_is_installable = machine.communicate.execute("yum info ansible", :error_check => false)
|
|
||||||
if ansible_is_installable != 0
|
|
||||||
machine.communicate.sudo(configure_epel)
|
|
||||||
end
|
|
||||||
machine.communicate.sudo("yum --assumeyes --quiet --enablerepo=epel install ansible")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module Ansible
|
||||||
|
module Cap
|
||||||
|
module Guest
|
||||||
|
module Fedora
|
||||||
|
module AnsibleInstall
|
||||||
|
|
||||||
|
def self.ansible_install(machine)
|
||||||
|
if dnf?(machine)
|
||||||
|
machine.communicate.sudo("dnf -y install ansible")
|
||||||
|
else
|
||||||
|
machine.communicate.sudo("yum -y install ansible")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.dnf?(machine)
|
||||||
|
machine.communicate.test("/usr/bin/which -s dnf")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module Ansible
|
||||||
|
module Cap
|
||||||
|
module Guest
|
||||||
|
module RedHat
|
||||||
|
module AnsibleInstall
|
||||||
|
|
||||||
|
def self.ansible_install(machine)
|
||||||
|
epel = machine.communicate.execute("#{yum_dnf(machine)} repolist epel | grep -q epel", :error_check => false)
|
||||||
|
if epel != 0
|
||||||
|
machine.communicate.sudo('sudo rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-`rpm -E %dist | sed -n \'s/.*el\([0-9]\).*/\1/p\'`.noarch.rpm')
|
||||||
|
end
|
||||||
|
|
||||||
|
machine.communicate.sudo("#{yum_dnf(machine)} -y --enablerepo=epel install ansible")
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.yum_dnf(machine)
|
||||||
|
machine.communicate.test("/usr/bin/which -s dnf") ? "dnf" : "yum"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -55,9 +55,14 @@ module VagrantPlugins
|
||||||
Cap::Guest::Ubuntu::AnsibleInstall
|
Cap::Guest::Ubuntu::AnsibleInstall
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guest_capability(:fedora, :ansible_install) do
|
||||||
|
require_relative "cap/guest/fedora/ansible_install"
|
||||||
|
Cap::Guest::Fedora::AnsibleInstall
|
||||||
|
end
|
||||||
|
|
||||||
guest_capability(:redhat, :ansible_install) do
|
guest_capability(:redhat, :ansible_install) do
|
||||||
require_relative "cap/guest/epel/ansible_install"
|
require_relative "cap/guest/redhat/ansible_install"
|
||||||
Cap::Guest::EPEL::AnsibleInstall
|
Cap::Guest::RedHat::AnsibleInstall
|
||||||
end
|
end
|
||||||
|
|
||||||
guest_capability(:suse, :ansible_install) do
|
guest_capability(:suse, :ansible_install) do
|
||||||
|
|
Loading…
Reference in New Issue