Puppetdebian

安装puppet

切换到 root用户,执行下面的命令,就把puppet客户端和服务器端都装好了.如果只是配置客户端,不用安装puppetmaster包

apt-get install puppet  puppetmaster

hello,world

用vi或者你习惯的编辑器编写一个名为 test.pp 的文件,内容如下

file {
      "/tmp/1.txt":
      content => "hello,world";
     }

然后执行
puppet test.pp

执行完以后,puppet会在生成/tmp/1.txt文件,文件的内容是 hello,world

来个复杂的例子,例如新装好一个系统,一般会做一些设置.比如安装一些常用的软件,关闭一些没用的服务等等.

package {
    ["vim","iproute","x-window-system","fcitx","netenv","xtrlock","ssh-askpass","mplayer","rxvt-unicode","curl","mtr"]:
    ensure => installed;
    ["nano","ppp","pppoe","pppoeconf"]:
    ensure => removed;
    }

file {
       "/home/hmy/.bashrc":
        content => "you content";
       "/home/hmy/.vimrc":
       content => "you content";
  }
service {
         "ssh":
          ensure => running;
         "portmap":
          ensure => stopped;
}

因此,在debian上面安装puppet是很容易的,装好后就可以简单的测试puppet的代码了.

除非特别注明,本页内容采用以下授权方式: Creative Commons Attribution-ShareAlike 3.0 License