Class: Kitchen::Provisioner::Ansible::Os::Fedora

Inherits:
Kitchen::Provisioner::Ansible::Os show all
Defined in:
lib/kitchen/provisioner/ansible/os/fedora.rb

Instance Attribute Summary

Attributes inherited from Kitchen::Provisioner::Ansible::Os

#name

Instance Method Summary collapse

Methods inherited from Kitchen::Provisioner::Ansible::Os

#initialize, make, #sudo, #sudo_env

Constructor Details

This class inherits a constructor from Kitchen::Provisioner::Ansible::Os

Instance Method Details

#ansible_package_nameObject



47
48
49
50
51
52
53
# File 'lib/kitchen/provisioner/ansible/os/fedora.rb', line 47

def ansible_package_name
  if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
    "ansible"
  else
    "ansible#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
  end
end

#install_commandObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/kitchen/provisioner/ansible/os/fedora.rb', line 26

def install_command
  <<-INSTALL

  if [ ! $(which ansible) ]; then
  #{redhat_yum_repo}
  #{update_packages_command}
  FEDORA_RELEASE=$(rpm --query --queryformat="%{VERSION}" --file /etc/fedora-release)

  if [ ${FEDORA_RELEASE} -le 28 ]; then
    #{sudo_env('dnf')} -y install #{ansible_package_name} libselinux-python git python2-dnf
  else
    #{sudo_env('dnf')} -y install #{ansible_package_name} python3-libselinux git python3-dnf
  fi
  fi
  INSTALL
end

#redhat_yum_repoObject



55
56
57
58
59
60
61
# File 'lib/kitchen/provisioner/ansible/os/fedora.rb', line 55

def redhat_yum_repo
  if @config[:ansible_yum_repo]
    <<-INSTALL
    #{sudo_env('rpm')} -ivh #{@config[:ansible_yum_repo]}
    INSTALL
  end
end

#update_packages_commandObject



43
44
45
# File 'lib/kitchen/provisioner/ansible/os/fedora.rb', line 43

def update_packages_command
  @config[:update_package_repos] ? "#{sudo_env('dnf')} makecache" : nil
end