salt简单来说就是等于强化版的func+弱化版的puppet

在这里我暂时将其用来替代func的作用(ps:虽然有点浪费)

架构如下:

 

puppet系列之salt模块_第1张图片

 

==================================
manifests
==================================
1,at /etc/puppet/modules/salt
-------------------------
init.pp
+++++++++++++++
class salt (
  $server_ip = "192.168.200.205"
){
        case $operatingsystem {
                centos:{
                        include salt::base
                        include salt::service
                }
        }
}
 
------------------------
base.pp
+++++++++++++++
class salt::base {
        package {"salt":
          ensure => present
        }
        package {"salt-minion":
          ensure  => present,
          require => package["salt"]
        }
}
-----------------------
service.pp
+++++++++++++++
class salt::service {
        file {"minion":
          content => template("salt/minion.erb"),
          owner => root,
          group => root,
          mode  => 640,
          path  => "/etc/salt/minion",
          require => Class["salt::base"],
          notify  => Service["salt-minion"]
        }

        service {"salt-minion":
          ensure  => running,
          enable  => true,
          require => Class["salt::base"],
          subscribe => File["minion"]
        }
}
 
==========================
templates
==========================
minion.erb
+++++++++++++++++++++++++++
master: <%= server_ip %>
----------------------------
 
备注:minion.erb就只调整了master的参数,如果要调整的,请自行修改,暂时更新到这,模块待续