Last active
December 17, 2015 14:29
-
-
Save jpadams/5624756 to your computer and use it in GitHub Desktop.
Puppet defined type to allow for installing a rpm with --noscripts option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class az { | |
| # This defined type is only for installing local rpm packages. Use puppet package type to remove. | |
| # Required parameters are rpm_name (can be found by running rpm -qp <package>) & rpm_path | |
| # I was going to wrap zypper with --download only option, but keeping it simple. | |
| # options can be changed to whatever is sane. --noscripts at a minimum for this case. | |
| define rpm_noscripts ( | |
| $rpm_name, | |
| $rpm_path, | |
| $ensure = 'installed', | |
| $options = '--noscripts --nodeps --force' | |
| ) { | |
| $rpm_install = "install_rpm_${rpm_name}_from_${rpm_path}" | |
| case $ensure { | |
| 'installed', 'present': { | |
| exec { $rpm_install: | |
| command => "rpm --install ${options} ${rpm_path}", | |
| unless => "rpm -q ${rpm_name}", | |
| path => ['/usr/bin', '/bin'], | |
| logoutput => on_failure, | |
| } | |
| # Create a package resource, this effectively does nothing but create | |
| # a graph node for the package that was manually installed above. | |
| package { $rpm_name: | |
| ensure => present, | |
| require => Exec[$rpm_install], | |
| } | |
| } | |
| default: { | |
| fail("Only present or installed is accepted") | |
| } | |
| } | |
| } | |
| # example install usage | |
| #az::rpm_noscripts { 'freenx': | |
| # rpm_name => 'freenx-0.7.3-9.4.el6.centos.x86_64', | |
| # rpm_path => '/tmp/freenx-0.7.3-9.4.el6.centos.x86_64.rpm', | |
| #} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment