Package Resources
The package resource can be used to help us install the software using the local Pack management system, or it can be installed by specifying a package with parameters.
1. Common Properties of package resources
Package {' Resource title ':
Allowcdrom
Description
Ensure
Provider
Source
}
Allowcdrom: Notifies apt to allow the use of CDROM as a source of software, which can be set to False or true.
Description: Describes the package.
ensure: Set the installation state of the package, you can set the value of present|installed|absent|latest|purged| " Version ".
= = present|installed, checks whether the file exists, does not exist the new
= = Absent, no other software dependencies, can be deleted, otherwise it will error.
= = Latest, check whether the file is the latest version, or upgrade to the latest version
= = purged, remove the package including all dependent packages, with the risk of caution
= "2.7.21-1", specifying that a version is in the installed state
provider: Different platforms are available in different packages.
Source: Specifies the installation source for the package.
Case 1
Installing httpd RPM packages through the package resource
Edit/etc/puppet/manifests/package.pp, add the following:
Package {' httpd ':
ensure = installed,
Provider = ' Yum ',
}
If it is a RPM package, you can also set this
Package {' httpd ':
ensure = installed,
Source = '/tmp/httpd-2.2.15-45.el6.centos.i686.rpm ',
Provider = ' rpm ',
}
# Puppet Apply Package.pp
NOTICE:/stage[main]//package[httpd]/ensure:created
notice:finished catalog run in 1.91 seconds
Case 2
The above is to install a package, if we install a large number of packages can be set
package {["httpd",
"Puppet",
"Nginx",
"OpenSSL"]:
ensure = installed,
}
please pay attention to http://www.wzlinux.com:45 and http://www.wzlinux.com .
This article is from the "Small Drops Linux" blog, make sure to keep this source http://wangzan18.blog.51cto.com/8021085/1685642
Puppet Advanced Guide--package Resources detailed