Skip to content

Instantly share code, notes, and snippets.

@spuder
Last active Aug 29, 2015
Embed
What would you like to do?
Puppet redis exec and install
# The case statment is running too late, it needs to run earlier
case $::osfamily {
redhat:{
$redis_6390_version = 'redis-6390-2.8.7-1.x86_64.rpm'
notify {"Installing redhat redis from /tmp/${redis_6390_vesion}":}
}
debian:{
$redis_6390_version = 'redis-6390_2.8.7_amd64.deb'
notify {"Installing debian redis from /tmp/${redis_6390_vesion}":}
}
default:{
fail("${::operatingsystem} not supported yet")
}
}
exec { 'wget redis':
command => "/usr/bin/wget http://foo.bar/redis/${redis_6390_version} -O /tmp/${redis_6390_version}",
#creates => "/tmp/${redis_6390_version}",
#before => Package['redis-6390'],
}
notify {"Installing redis from /tmp/${redis_6390_vesion}":}
package {'redis-6390':
ensure => installed,
source => "/tmp/${redis_6390_version}"
# source => 'http://foo.bar/redis/redis-6390-2.8.7-1.x86_64.rpm',
# name => 'redis-6390-2.8.7-1.x86_64.rpm',
}
@spuder
Copy link
Author

spuder commented Apr 10, 2014

In the output, notice that the message "Installing redis from /tmp/" appears before the message "Installing redhat redis from /tmp'.
Also, I suspect that the reason the package is failing is because it can't find the location of the rpm

Notice: /Stage[main]/Main/Notify[Installing redis from /tmp/]/message: defined 'message' as 'Installing redis from /tmp/'
Debug: /Stage[main]/Main/Notify[Installing redis from /tmp/]: The container Class[Main] will propagate my refresh event
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n''
Debug: Executing '/bin/rpm -q redis-6390 --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
Debug: Package[redis-6390](provider=yum): Ensuring => present
Debug: Executing '/usr/bin/yum -d 0 -e 0 -y install redis-6390'
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install redis-6390' returned 1: Error: Nothing to do

Error: /Stage[main]/Main/Package[redis-6390]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install redis-6390' returned 1: Error: Nothing to do

Notice: Installing redhat redis from /tmp/
Notice: /Stage[main]/Main/Notify[Installing redhat redis from /tmp/]/message: defined 'message' as 'Installing redhat redis from /tmp/'
Debug: /Stage[main]/Main/Notify[Installing redhat redis from /tmp/]: The container Class[Main] will propagate my refresh event
Debug: Class[Main]: The container Stage[main] will propagate my refresh event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment