puppet在使用过程中可能会遇到未知某个资源某一个参数的含义,系统所支持的资源列表,如果生产puppet代码等。
查看系统puppet当前版本可用的资源列表
[iyunv@linux58poc ~]# puppet describe --list
These are the types known to puppet:
augeas - Apply a change or an array of changes to the ...
computer - Computer object management using DirectorySer ...
cron - Installs and manages cron jobs
exec - Executes external commands
file - Manages files, including their content, owner ...
filebucket - A repository for backing up files
group - Manage groups
host - Installs and manages host entries
interface - This represents a router or switch interface
k5login - Manage the `
macauthorization - Manage the Mac OS X authorization database
mailalias - Creates an email alias in the local alias dat ...
maillist - Manage email lists
mcx - MCX object management using DirectoryService ...
mount - Manages mounted filesystems, including puttin ...
nagios_command - The Nagios type command
nagios_contact - The Nagios type contact
nagios_contactgroup - The Nagios type contactgroup
nagios_host - The Nagios type host
nagios_hostdependency - The Nagios type hostdependency
nagios_hostescalation - The Nagios type hostescalation
nagios_hostextinfo - The Nagios type hostextinfo
nagios_hostgroup - The Nagios type hostgroup
nagios_service - The Nagios type service
nagios_servicedependency - The Nagios type servicedependency
nagios_serviceescalation - The Nagios type serviceescalation
nagios_serviceextinfo - The Nagios type serviceextinfo
nagios_servicegroup - The Nagios type servicegroup
nagios_timeperiod - The Nagios type timeperiod
notify - Sends an arbitrary message to the agent run-t ...
package - Manage packages
resources - This is a metatype that can manage other reso ...
router - Manages connected router
schedule - Define schedules for Puppet
scheduled_task - Installs and manages Windows Scheduled Tasks
selboolean - Manages SELinux booleans on systems with SELi ...
selmodule - Manages loading and unloading of SELinux poli ...
service - Manage running services
ssh_authorized_key - Manages SSH authorized keys
sshkey - Installs and manages ssh host keys
stage - A resource type for specifying run stages
tidy - Remove unwanted files based on specific crite ...
user - Manage users
vlan - Manages a VLAN on a router or switch
whit - Whits are internal artifacts of Puppet's curr ...
yumrepo - The client-side description of a yum reposito ...
zfs - Manage zfs
zone - Manages Solaris zones
zpool - Manage zpools
查看资源"user"的详细参数信息
[iyunv@linux58poc ~]# puppet describe user --providers
user
====
Manage users. This type is mostly built to manage system
users, so it is lacking some features useful for managing normal
users.
This resource type uses the prescribed native tools for creating
groups and generally uses POSIX APIs for retrieving information
about them. It does not directly modify `/etc/passwd` or anything.
**Autorequires:** If Puppet is managing the user's primary group (as
provided in the `gid` attribute), the user resource will autorequire
that group. If Puppet is managing any role accounts corresponding to the
user's roles, the user resource will autorequire those role accounts.
Parameters
----------
- **allowdupe**
Whether to allow duplicate UIDs. Defaults to `false`. Valid values are
`true`, `false`.
- **attribute_membership**
Whether specified attribute value pairs should be treated as the
**complete list** (`inclusive`) or the **minimum list** (`minimum`) of
attribute/value pairs for the user. Defaults to `minimum`. Valid values
are `inclusive`, `minimum`.
- **attributes**
Specify AIX attributes for the user in an array of attribute = value
pairs. Requires features manages_aix_lam.
- **auth_membership**
Whether specified auths should be considered the **complete list**
(`inclusive`) or the **minimum list** (`minimum`) of auths the user
has. Defaults to `minimum`. Valid values are `inclusive`, `minimum`.
查看资源"service"的详细参数信息
[iyunv@linux58poc ~]# puppet describe service --providers
service
=======
Manage running services. Service support unfortunately varies
widely by platform --- some platforms have very little if any concept of a
running service, and some have a very codified and powerful concept.
Puppet's service support is usually capable of doing the right thing, but
the more information you can provide, the better behaviour you will get.
Puppet 2.7 and newer expect init scripts to have a working status command.
If this isn't the case for any of your services' init scripts, you will
need to set `hasstatus` to false and possibly specify a custom status
command in the `status` attribute.
Note that if a `service` receives an event from another resource,
the service will get restarted. The actual command to restart the
service depends on the platform. You can provide an explicit command for
restarting with the `restart` attribute, or you can set `hasrestart` to
true to use the init script's restart command; if you do neither, the
service's stop and start commands will be used.
Parameters
----------
- **binary**
The path to the daemon. This is only used for
systems that do not support init scripts. This binary will be
used to start the service if no `start` parameter is
provided.
- **control**
The control variable used to manage services (originally for HP-UX).
Defaults to the upcased service name plus `START` replacing dots with
underscores, for those providers that support the `controllable`
feature.
- **enable**
Whether a service should be enabled to start at boot.
This property behaves quite differently depending on the platform;
wherever possible, it relies on local tools to enable or disable
a given service. Valid values are `true`, `false`, `manual`. Requires
features enableable.
- **ensure**
Whether a service should be running. Valid values are `stopped` (also
called `false`), `running` (also called `true`).
- **hasrestart**
Specify that an init script has a `restart` command. If this is
false and you do not specify a command in the `restart` attribute,
the init script's `stop` and `start` commands will be used. Defaults
to true; note that this is a change from earlier versions of Puppet.
Valid values are `true`, `false`.
将当前系统用户puppet的状态转换为puppet代码
[iyunv@linux58poc ~]# puppet resource user puppet
user { 'puppet':
ensure => 'present',
comment => 'Puppet',
gid => '52',
home => '/var/lib/puppet',
password => '!!',
password_max_age => '-1',
password_min_age => '-1',
shell => '/sbin/nologin',
uid => '52',
}
将当前系统文件puppet.conf的状态转换为puppet代码
[iyunv@linux58poc ~]# puppet resource file /etc/puppet/puppet.conf
file { '/etc/puppet/puppet.conf':
ensure => 'file',
content => '{md5}0657fad97cf02166435edf912c828e0b',
ctime => 'Thu Jan 09 05:48:26 +0800 2014',
group => '52',
mode => '644',
mtime => 'Thu Jan 09 05:48:26 +0800 2014',
owner => '52',
type => 'file',
}