Puppet resource Summary
Resource introduction:
Common resources: file, service, and package
Tool resources: exec, cron, user, group
Resource Summary
File
Present checks whether the file exists. If the file does not exist, it is created.
Absent checks whether the file exists and creates the file if it exists.
Directory specifies this is a directory
Path => (full file path, same as title by default)
Source => File Retrieval address, which is read from the master starting with puppet: //
Content => File content
Recurse => true for directory (true) No (false) recursion (ensure => directory is valid)
Owner => file owner
Group => File group
Mode => File Permission
Package:
Present check whether the package exists. Install the package if it does not exist (you can also write it as installed)
Absent checks whether the package exists and uninstalls the package if it exists.
Laster checks whether the package is up-to-date. If not, upgrade it to the latest version.
Pureged clean remove the software
Service:
Running
Stopped stop status
True boot
False boot not started
Name => service name, which is the same as the title by default
Start, stop, restart, status => Service Startup, shutdown, and restart (start => "/etc/init. d/nginx start ")
Hasrestart => false/true this management script supports the restart command. The default value is false. If no value is set, stop/start is used to restart the script.
Hasstatus => false/true this script supports the status command. The default value is false. If not, use grep to determine
Pattern => "XXX" sets the specified string of the collection process. When the restart/status command is not supported, grep collects the data based on this value.
Binary => when the service does not have an init script, the binary Package ontology of the program is directly used. The value of the binary Attribute is the complete path of the ontology.
Subscribe => File ["configuration File path"] When the configuration File changes, restart the service.
User:
Present is generated if the user does not exist.
Absent delete user
Name => User name, which is the same as title by default
Uid => User ID, automatically generated if not specified
Gid => GID of the user group
Groups => name of the user group to which the user belongs, which can be a list
Home => user's home directory
Managehome => whether to automatically generate the home directory. The default value is false. You must manually specify
Shell => shell (/bin/bash |/sbin/nologin) assigned by the user by default after login)
Group:
Present is created if the user group does not exist.
Delete if the absent user group exists
Name => User Group name. The default value is title.
Gid => User Group ID
System => whether the user group is a system group. A small GID is used. The default value is false.
Members => ['user1', 'user2'] group members
Cron:
Present If the cron does not exist, add
Absent: Delete the cron if it exists.
Command => script command and path to be executed
Hour (0-23), minute (0-59), month (1-12), monthday (1-31), weekday (0-7) => schedule of scheduled tasks. The list is supported (for example, [2, 4]).
User => user executed to cron
Exec:
Path => set the command PATH, which is the same as the path environment variable.
Command => Run command. If no path is specified, the complete path must be written.
Creates => Create if the "filename" file does not exist
Cwd => specifies the directory for command execution. If the directory does not exist, the execution fails.
Onlyif => when the command in this attribute is successfully executed, this name is returned for running.
Unless => opposite to onlyif
Puppet Learning Series:
Puppet Learning 1: Installation and simple instance applications
Puppet 2: simple module configuration and application
Research on three Backup Recovery solutions for Puppet agent
Register your Puppet node in a safer way
Deep understanding of Puppet syntax and working mechanism through SSH Configuration
Puppet uses Nginx multiple ports for Load Balancing
C/S mode instance of Puppet in CentOS (5 and 6)
For more information about Puppet, click here.
Puppet: click here
This article permanently updates the link address: