1 | wget https://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb |
1 2 | sudo dpkg -i puppetlabs-release-pc1-trusty.deb sudo apt-get update |
1 | sudo apt-get install puppetserver |
1 | sudo service puppetservice start |
1 | sudo apt-get install puppet-agent |
1 2 | [main] server = puppetmaster |
1 | sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true |
1 2 3 4 5 6 7 8 9 10 11 12 | node puppetagent { file { 'helloworld': path => '/etc/helloworld.txt', owner => 'root', group => 'root', mode => '655', content => "hello world from puppet!\n", } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | root@puppetAgent:/opt/puppetlabs/bin# ./puppet agent --test 2016-05-21 14:24:14.858673 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for puppetagent Info: Applying configuration version '1463811856' Notice: /Stage[main]/Main/Node[puppetagent]/File[helloworld]/ensure: defined content as '{md5}c3aa68786c58c94ef6f3e2399920f268' Notice: Applied catalog in 0.02 seconds root@puppetAgent:/opt/puppetlabs/bin# cat /etc/helloworld.txt hello world from puppet! |
1 2 | touch /etc/helloworld.log echo "helloworld" >> /etc/helloworld.log |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | node puppetagent { file { 'test.sh': path => '/etc/test.sh', owner => 'root', group => 'root', mode => '655', source => 'puppet:///modules/test/test.sh', } exec { 'execute ': command => 'bash /etc/test.sh', require => File['test.sh'], path => ["/bin/"], } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | root@puppetAgent:/opt/puppetlabs/bin# ./puppet agent --test 2016-05-21 15:39:39.817370 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for puppetagent Info: Applying configuration version '1463816381' Notice: /Stage[main]/Main/Node[puppetagent]/File[test.sh]/ensure: defined content as '{md5}2ce060ad2ddab2fe416ca8fb6f8da32a' Notice: /Stage[main]/Main/Node[puppetagent]/Exec[execute ]/returns: executed successfully Notice: Applied catalog in 0.05 seconds root@puppetAgent:/opt/puppetlabs/bin# cat /etc/helloworld.log helloworld |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |