Puppet – How to install git 1.8.x which isn’t in default packages

aptgitgitlabpuppet

How would you automate the installation of a specific version of git using puppet?

apt-get update && apt-get install git-core on my 12.04 ubuntu server results in git version 1.7.9.
I must have 1.7.10 or newer.

There are two options that I can see.
1. Add the ppa
2. Install git from source

I think adding a ppa would be easier that compiling from source, so that is what I am attempting.

I've tried using the puppetlabs/apt module to install the git-core ppa, yet my git version is still 1.7.9 after the puppet run.

root@gitlab:~# puppet module list
/etc/puppet/modules
├── puppetlabs-apt (v1.2.0)
├── puppetlabs-git (v0.0.3)
├── puppetlabs-stdlib (v4.1.0)
└── ruby (???)


root@gitlab:~# cat /etc/puppet/manifests/git.pp  

class { 'apt': }
apt::ppa { 'ppa:git-core/ppa': 
  before => Exec['apt-get update'],

}

exec{'apt-get update':
  path => ['/usr/bin', '/usr/sbin'],
}

package {'git-core':
   ensure => latest,
   require => Exec['apt-get update'],
}

root@gitlab:~# puppet apply /etc/puppet/manifests/git.pp --verbose
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Applying configuration version '1379214336'
Notice: /Stage[main]//Exec[apt-get update]/returns: executed successfully
Notice: Finished catalog run in 5.80 seconds
root@gitlab:~# git --version
git version 1.7.9.5

Best Answer

git-core isn't the package in that PPA - you want git instead (and probably to remove git-core from the Ubuntu repo).

Related Topic