0 Basic Learning Puppet Automation configuration Management Series documentation
Note: The following is an operation in a foreman1.6.3+puppet2.6.2 environment. For more configuration, please refer to official website http://theforeman.org/manuals/1.6/index.html
in the Foreman-proxy 1.6.3 version, at least the following five types of tools triggering the puppet Agent command are available, the default is Puppetrun, but it's obsolete, here's how to use mcollective for triggering. The next section describes how to use the PUPPETSSH trigger.
# Puppetrun (for Puppetrun/kick, deprecated in Puppet 3) # mcollective (uses MCO Puppet) # puppetssh (Run Puppet o ver ssh) # Salt (uses salt puppet.run) # Customrun (calls a custom command with args)
Before the entire test, it is OK to first ensure that your mco+mq is in the command line operation. If there is no OK or do not know what is mco+mq, please refer to the previous article.
How is OK? As follows:
[[Email protected] yum.repos.d]# mco puppet -v runoncediscovering hosts using the mc method for 2 second (s) .... 1 * [ == ==========================================================> ] 1 / 1puppetmaster162.kisspuppet.com : ok {:summary=> "started a puppet run using the ' puppet agent --test --color=false --splay --splaylimit 30 ' command "}---- rpc stats ---- nodes: 1 / 1 pass / fail: 1 / 0 Start Time: Wed Dec 17 16:22:15 +0800 2014 discovery time: 2004.22ms agent time: 71.49ms Total time: 2075.70ms
1, open the Puppetrun function of puppet plug-in in foreman
650) this.width=650; "src=" Http://kisspuppet.com/img/foreman07-1.png "alt=" Foreman Install "style=" margin:0px;padding:0 Px;height:auto;border:none; "/>Foreman installation
650) this.width=650; "src=" Http://kisspuppet.com/img/foreman07-2.png "alt=" Foreman Install "style=" margin:0px;padding:0 Px;height:auto;border:none; "/>Foreman installation
2, configure the Foreman-proxy agent of the puppet Puppet_provider
[[email protected] ~]# vim /etc/foreman-proxy/settings.d/puppet.yml ---# Puppet management:enabled: true:puppet_conf: /etc/puppet/puppet.conf# valid providers:# puppetrun (For puppetrun/kick, deprecated in puppet 3) # mcollective (Uses mco puppet) # puppetssh (RUN PUPPET OVER SSH) # salt (Uses salt puppet.run) # customrun (calls a Custom command with args):p uppet_provider: mcollective ...
3, configure Sudoer, add MCO command
[Email protected] ~]# vim/etc/sudoers.d/foreman-proxy foreman-proxy all = nopasswd:/usr/bin/puppet cert *,/USR/BIN/MC o Puppet RunOnce *defaults:foreman-proxy!requiretty[[email protected] ~]#/etc/init.d/foreman-proxy restartstopping Foreman-proxy: [OK]starting foreman-proxy: [OK ]
4. Page Test Puppetrun button
650) this.width=650; "src=" Http://kisspuppet.com/img/foreman07-3.png "alt=" Foreman Install "style=" margin:0px;padding:0 Px;height:auto;border:none; "/>Foreman installation
The display after success
650) this.width=650; "src=" Http://kisspuppet.com/img/foreman07-4.png "alt=" Foreman Install "style=" margin:0px;padding:0 Px;height:auto;border:none; "/>Foreman installation
5, see the report for more detailed information
#可以通过日志查看执行情况 [[email protected] yum.repos.d]# tailf /var/log/foreman-proxy/ proxy.log192.168.20.11 - - [17/dec/2014 16:25:36] "POST /run HTTP/1.1" 200 - 0.5454 above [[Email protected] ~]# cat /etc/foreman-proxy/settings.yml ...: Log_file: /var/log/foreman-proxy/proxy.log# valid options are# warn, debug, Error, Fatal, INFO, UNKNOWN:log_level: DEBUG #开启debug模式, display more detailed information, use when troubleshooting. The default is open before version 1.5 [[email protected] yum.repos.d]# tailf /var/log/foreman-proxy/ proxy.logi, [2014-12-17t16:27:43.148519 #24337] info -- : ' Foreman_proxy ' settings were initialized with default values: :enabled: trueW, [2014-12-17t16:27:43.155592 #24337] warn -- : couldn ' t find settings file /etc/foreman-proxy/setTings.d/facts.yml. using default settings. i, [2014-12-17t16:27:43.155860 #24337] info -- : ' facts ' settings were initialized with default values: :enabled: truei, [2014-12-17t16 :27:43.163012 #24337] info -- : ' DNS ' module is disabled. i, [2014-12-17t16:27:43.163513 #24337] info -- : ' tftp ' module Is disabled. i, [2014-12-17t16:27:43.163933 #24337] info -- : ' DHCP ' module Is disabled. i, [2014-12-17t16:27:43.579571 #24337] info -- : ' puppet ' settings were initialized with default values: :p uppetdir: /etc/puppeti, [ 2014-12-17t16:27:43.583486 #24337] info -- : ' BMC ' module is disabled.i, [2014-12-17t16:27:43.583655 #24337] info -- : ' Chefproxy ' module is disabled. i, [2014-12-17t16:27:43.583934 #24337] info -- : ' Realm ' module Is disabled. d, [2014-12-17t16:28:15.059328 #24344] debug -- : about to execute: /usr/bin/sudo -u root /usr/bin/mco puppet runonce -I puppetmaster162.kisspuppet.com192.168.20.11 - - [17/dec/2014 16:28:15] "POST / run http/1.1 " 200 - 0.5468
The failure scenario is as follows:
650) this.width=650; "src=" Http://kisspuppet.com/img/foreman07-5.png "alt=" Foreman Install "style=" margin:0px;padding:0 Px;height:auto;border:none; "/>Foreman installation
[[Email protected] ~]# tailf /var/log/foreman-proxy/proxy.logi, [2014-12-17t16 :27:43.163933 #24337] info -- : ' DHCP ' module is disabled. i, [2014-12-17t16:27:43.579571 #24337] info -- : ' puppet ' settings were initialized with default values: :p uppetdir: /etc/puppeti, [ 2014-12-17t16:27:43.583486 #24337] info -- : ' BMC ' module is Disabled. i, [2014-12-17t16:27:43.583655 #24337] info -- : ' Chefproxy ' module is disabled. i, [2014-12-17t16:27:43.583934 #24337] info -- : ' Realm ' module Is disabled. d, [2014-12-17t16:28:15.059328 #24344] debug -- : about to execute: /usr/bin/sudo -u root /usr/bin/mco puppet runonce -i p uppetmaster162.kisspuppet.com192.168.20.11 - - [17/dec/2014 16:28:15] "POST / run http/1.1 " 200 - 0.5468D, [2014-12-17T16:32:56.924849 #24344] debug -- : about to execute: /usr/bin/sudo -u root /usr/bin/mco puppet runonce -i puppetmaster162.kisspuppet.com192.168.20.11 - - [17/dec/2014 16:32:57] "post /run http/1.1" 200 - 0.6095d, [2014-12-17t16 :32:57.878231 #24344] debug -- : about to execute: /usr/bin/sudo -u root /usr/bin/mco puppet runonce -i foreman163.kisspuppet.comw, [ 2014-12-17t16:33:20.364704 #24344] warn -- : non-null exit code when executing '/usr/bin/sudo-uroot/usr/bin/mcopuppetrunonce-iforeman163.kisspuppet.com ' E, [ 2014-12-17t16:33:20.368673 #24344] error -- : failed puppet run: check log files192.168.20.11 - - [17/Dec/2014 16:33:20] "post /run http/1.1" 500 34 22.4920
remark: Foreman after the command execution of the show this block is actually very bad, how to be able to do all the node execution of the situation dynamic or display on the interface is better!
This article is from the "www.kisspuppet.com" blog, make sure to keep this source http://dreamfire.blog.51cto.com/418026/1591389
Introduction of Foreman Architecture 7-foreman combined with mcollective to complete push action