CentOS 7
Ads

Puppet : How to use [package Resource]
2015/07/22
 
This is the exmaples for package resource.
[1] It manages the configuration to keep "httpd" is installed.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
package { 'httpd':
    provider => yum,
    ensure   => installed,
}
[2] It manages the configuration to keep the "latest httpd" is installed.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
package { 'httpd':
    provider => yum,
    ensure   => latest,
}
[3] It manages the configuration to keep "epel-release" is installed by rpm.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
package { 'epel-release':
    provider => rpm,
    ensure   => installed,
    source   => 'http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm',
}
[4] It manages the configuration to keep "httpd" is not installed. (deleted if installed)
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
package { 'httpd':
    provider => yum,
    ensure   => purged,
}
 
Tweet