Class: Kitchen::Provisioner::Ansible::Os::Amazon

Inherits:
Redhat show all
Defined in:
lib/kitchen/provisioner/ansible/os/amazon.rb

Instance Attribute Summary

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

#name

Instance Method Summary collapse

Methods inherited from Redhat

#ansible_package_name, #ansible_package_version_suffix, #install_epel_repo, #redhat_yum_repo, #update_packages_command

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

#install_commandObject



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

def install_command
  <<-INSTALL

  if [ ! $(which ansible) ]; then
    #{install_epel_repo}
    #{sudo_env('yum-config-manager')} --enable epel/x86_64
    #{sudo_env('yum')} -y install git

    if `grep -q "Amazon Linux AMI" /etc/os-release`; then
      ## Amazon Linux 1
      #{sudo_env('yum')} -y install #{ansible_package_name}
      #{sudo_env('alternatives')} --set python /usr/bin/python2.6
      #{sudo_env('yum')} clean all
      #{sudo_env('yum')} install yum-python26 -y
    else
      ## Amazon Linux 2
      #{sudo_env('amazon-linux-extras')} install -y ansible2
    fi
  fi
  INSTALL
end