You can view and modify the state of a system's resource by using the puppet resource command. This command converts the current system state into Puppet's declarative language, which you can then use to enforce configuration on other systems.
The following example shows how you would view the state of the zone resource type:
# puppet resource zone zone { 'global': ensure => 'running', brand => 'solaris', iptype => 'shared', zonepath => '/', } zone { 'myzone': ensure => 'running', brand => 'solaris-kz', iptype => 'excl', zonepath => '/system/volatile/zones/myzone/zonepath', }
In the previous example, there are two zone resources declared: a global zone and an installed kernel zone. Each of these resources has four attributes: ensure, brand, iptype, and zonepath. Each attribute has a value associated with it. This value is a central component of Puppet's declarative language.
The following example shows how you would view the state of the service resource type:
# puppet resource service svc:/network /dns/client:default service {'svc:/network/dns/client:default': ensure => 'running', enable =>'true', }
You can also use the puppet resource command to modify the state of a resource. You would use this method in lieu of directly modifying the configuration within a Puppet manifest.
For example, you would modify the state of the service resource type as follows:
# puppet resource service svc:/network/dns/client:default enable=false Notice: /Service[svc:/network/dns/client:default]/enable: enable changed 'true' to 'false' service { 'svc:/network/dns/client:default': ensure => 'stopped', enable => 'false', }