In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
one。 Local pp file test package {"nginx": # function: install nginx ensure= > latest,} service {"nginx": # function: start nginx And let the settings boot ensure= > running, enable= > true, restart = > "systemctl restart nginx.service", # restart subscribe = > file ["/ etc/nginx/nginx.conf"] only if notified or subscribed, # listen to the following service. If triggered, restart the nginx # test and conclude that if the new file already exists in advance, it has not been modified. Restarting nginx will not be triggered. } file {"/ etc/nginx/nginx.conf": # function: copy nginx configuration file ensure= > file, content= > template ("/ root/nginx.conf"),}
Puppet apply-v-- noop cs.pp # test run, not really installed, used to read errors
Puppet apply-v cs.pp # actually runs the installation
two。 Dependence of resources
Before: indicates that you need to rely on a resource
Require: indicates that this resource should be executed first and other resources should be executed
Notify:A notify BRV B depends on An and notifies B when A changes
Subscribe:B subscribe avatar B depends on A, and B monitors events resulting from changes in A resources
Subscribe example:
Package {"httpd": ensure= > present,subscribe = > package ["nginx"], # means to subscribe to the following resource. If the following resource is not executed successfully, the resource will not be executed, and the following resource has been executed successfully or is already in the state of finished execution. This resource will execute} package {"nginx": ensure= > present,} notify example: package {"httpd": ensure= > present,} package {"nginx": ensure= > present,notify= > package ["httpd"], # indicates that the resource has been executed and notifies the above resource that the resource is not executed successfully The above resource will not execute} dependencies can also be sorted using-> and ~ > for example: exec {"echo'1' > > / root/2333.txt": path = > ["/ usr/bin", "/ usr/sbin"],} exec {"echo'2' > > / root/2333.txt": path = > ["/ usr/bin", "/ usr/sbin"],} exec {"echo'3' > > / root/2333.txt": path = > ["/ usr/bin" "/ usr/sbin"],} exec ["echo'3' > > / root/2333.txt"]-> exec ["echo'2' > > / root/2333.txt"]-> exec ["echo'1' > > / root/2333.txt"] if it is normal, the output should be 123 But I use the-> symbol to define the running order, and the final output is
three。 Introduction of several commonly used resources
1.exec resource exec {"mkdir 666": # command cwd = > "/ root/", # execute the command in that path, give creates = > "/ root/678" if the path does not exist, # judge, if you have this folder, you will not execute the path = > ["/ usr/bin", "/ usr/sbin"] # command program Go to that path to find the execution file} 2.package (installation software) package {["httpd.x86_64", "nginx.x86_64"]: # to separate multiple installable software ensure = > purged, # latest install the latest, installed installation Purged delete package provider = > "yum", # install in yum source in yum mode} package {"nginx": ensure = > installed, provider = > "rpm", # install as rpm local file, you must specify the path to the installation file below Otherwise, source = > "/ root/nginx-1.8.1-1.el7.ngx.x86_64.rpm"} 3.service and flieclass xingjian {service {"nginx": ensure = > running, # set to what state running is running, stopped stop status enable = > true, # whether to enable self-starting true Yes, false No hasrestart = > true, hasstatus = > true, require = > file ['/ etc/nginx/nginx.conf'] # when executing a resource, first check whether the following resource executes} file {"/ etc/nginx/nginx.conf": # replication path ensure = > file, # file type File directly copies the original type. If you want to enter link, create a linked file, but if you want to create a linked file, the following source should be replaced with target. If you enter directory, you will copy the folder. Need to add recurse='true' implementation to copy source = > "/ root/nginx.conf", # source file path}} 4.cron (scheduled task) cron {"jihua": command = > "/ root/1.sh", # # path name of execution script or command path name ensure = > "present", # present add if the cron does not exist Absent delete minute = > "* / 5" if the cron exists and run it every # 5 minutes Same as crontab usage: target = > "root", # under which user to execute script} 5 user and group group {"yangzai": # group name ensure = > present, gid = > "2333", system = > false, whether # is a system group # members: member user } user {"yangzai": # username ensure = > present, system = > false, comment = > "233", # comment Generally describe what software to run shell = > "/ bin/bash", # default shell home = > "/ home/yangzai", # home directory path managehome = > true, # whether to create a home directory groups = > "yangzai" Uid = > "2333"} 7. Notify {"hello world":} # display information
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.