Select a safer method for executing your puppet update
In the production environment, puppet updates require automatic node updates, puppetmaster to push updates, and node Update time discretization. The following describes three update methods.
2.7 Puppet update Method
2.7.1 scheduled node update
[Root @ agent1 ~] # Vim/etc/puppet. conf
[Main]
Server = puppetserver.rsyslog.org # point to puppetserver server
[Agent]
Runinterval = 5 # You can use the client to automatically update the test in the early stage, and set the agent to synchronize in 5 seconds.
2.7.2 node discrete update needs to be tested)
Use the inline_template function of puppet in combination with the cron task plan to execute distributed updates on the agent server.
Cron {"run-puppet ":
Command => "/usr/sbin/puppet agent -- server = puppetserver.rsyslog.org -- test>/dev/null 2> & 1 ",
Minute => inline_template ("<% = hostname. hash % 60%> "),
}
Note: If the number of nodes is large, you can consider method 2 to reduce the pressure on the puppet server at the same time.
Implementation principle: the hash value generated by each host name in the hash table based on the host name of the client is unique) and used as the minute or hour of the scheduled task, each client runs puppet in different minutes in the past hour. This three-column technique is useful for random cron jobs and increases the possibility because they do not interfere with each other. The value generated by Hash can be infinitely large. In the above example, only 0-60 is generated, that is, the maximum value is 60.
2.7.3 server push update puppet kick)
1) modify the main configuration file of the agent.
[Root @ agent1 ~] # Vim/etc/puppet. conf
[Agent]
Listen = true
...
2) Modify/etc/sysconfig/puppet
[Root @ agent1 ~] # Vim/etc/sysconfig/puppet
PUPPET_SERVER = puppetserver.rsyslog.org
...
3) Create the namespaceauth. conf file.
[Root @ agent1 ~] # Vim/etc/puppet/namespaceauth. conf
[Puppetrunner]
Allow puppetserver.rsyslog.org
4) modify the auth. conf file and add it before path)
[Root @ agent1 ~] # Vim/etc/puppet/auth. conf
Path/run
Method save
Allow puppetserver.rsyslog.org
Auth any
Path/
Auth any
5) restart the agent.
6) run the puppetrun command on the puppetmaster side to test
[Root @ puppetserver ~] # Puppetrun-p 10 -- host agent1.rsyslog.org
Triggering agent1.rsyslog.org
Getting status
Status is success
Agent1.rsyslog.org finished with exit code 0
Finished
Note: if there are more scripts, you can create a hosts.txt file. Then, you can copy the updated node name to the hosts.txt file, and then follow the -- host 'cat hosts.txt 'parameter.
New automated O & M management group:296934942You are welcome to join the discussion!
This article is from the blog of "the Linux open source technology blog", please be sure to keep this source http://dreamfire.blog.51cto.com/418026/1257718