Module: VagrantPlugins::Ansible::Cap::Guest::RedHat::AnsibleInstall

Defined in:
lib/cap/guest/redhat/ansible_install.rb

Class Method Summary collapse

Class Method Details

.ansible_install(machine) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/cap/guest/redhat/ansible_install.rb', line 9

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

.yum_dnf(machine) ⇒ Object



18
19
20
# File 'lib/cap/guest/redhat/ansible_install.rb', line 18

def self.yum_dnf(machine)
  machine.communicate.test("/usr/bin/which -s dnf") ? "dnf" : "yum"
end