diff options
author | kwadronaut <kwadronaut@leap.se> | 2014-07-29 19:08:36 +0200 |
---|---|---|
committer | kwadronaut <kwadronaut@leap.se> | 2014-07-29 19:08:36 +0200 |
commit | ba32e368e22078cac65d27531a1cf7d0962ec984 (patch) | |
tree | d28ae4bd79d5d4f61ecf3d8b8cd55c9e306b960d /manifests/install.pp | |
parent | 78c4e8d748138833ba07b71bcfc1ea538c4a2dfb (diff) | |
parent | 1696203589b66cc374bd8f5f21e82d5b92eb391b (diff) |
Diffstat (limited to 'manifests/install.pp')
-rw-r--r-- | manifests/install.pp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/manifests/install.pp b/manifests/install.pp index cf0a13e..a8d7d36 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,36 +1,68 @@ +# == Define: python::install +# +# Installs core python packages +# +# === Examples +# +# include python::install +# +# === Authors +# +# Sergey Stankevich +# Ashley Penney +# Fotis Gimian +# + class python::install { $python = $python::version ? { 'system' => 'python', + 'pypy' => 'pypy', default => "python${python::version}", } - $pythondev = $::operatingsystem ? { - /(?i:RedHat|CentOS|Fedora)/ => "$python-devel", - /(?i:Debian|Ubuntu)/ => "$python-dev" + $pythondev = $::osfamily ? { + 'RedHat' => "${python}-devel", + 'Debian' => "${python}-dev" } - package { $python: ensure => present } - $dev_ensure = $python::dev ? { true => present, default => absent, } - package { [ $pythondev, 'python-pip' ]: ensure => $dev_ensure } - - $venv_ensure = $python::virtualenv ? { + $pip_ensure = $python::pip ? { true => present, default => absent, } - package { 'python-virtualenv': ensure => $venv_ensure } - - $gunicorn_ensure = $python::gunicorn ? { + $venv_ensure = $python::virtualenv ? { true => present, default => absent, } - package { 'gunicorn': ensure => $gunicorn_ensure } + # Install latest from pip if pip is the provider + case $python::provider { + pip: { + package { 'virtualenv': ensure => latest, provider => pip } + package { 'pip': ensure => latest, provider => pip } + package { $pythondev: ensure => latest } + package { "python==${python::version}": ensure => latest, provider => pip } + } + default: { + package { 'python-virtualenv': ensure => $venv_ensure } + package { 'python-pip': ensure => $pip_ensure } + package { $pythondev: ensure => $dev_ensure } + package { $python: ensure => present } + } + } + + if $python::manage_gunicorn { + $gunicorn_ensure = $python::gunicorn ? { + true => present, + default => absent, + } + package { 'gunicorn': ensure => $gunicorn_ensure } + } } |