1. 环境准备

    OS: CentOS 6.4 (使用一套纯净的OS,最小化安装即可)

    关闭selinux和iptables

    

    Yum源使用:

rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm 
rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm 
yum -y install http://yum.theforeman.org/releases/1.7/el6/x86_64/foreman-release.rpm



2. 部署Foreman

yum install puppet-server puppet
yum install foreman-proxy foreman-cli
yum -y install foreman-installer


foreman-installer \
  --foreman-admin-username=admin \
  --foreman-admin-password=admin \
  --foreman-configure-epel-repo=false \
  --foreman-db-database=mysql \
  --foreman-db-host=localhost \
  --foreman-db-password=foreman \
  --foreman-db-port=3306 \
  --foreman-db-type=mysql \
  --foreman-db-username=foreman


   成功安装后的状态..

  Success!
  * Foreman is running at https://master.dbsa.cn
      Initial credentials are admin / admin
  * Foreman Proxy is running at https://master.dbsa.cn:8443
  * Puppetmaster is running at port 8140
  The full log is at /var/log/foreman-installer/foreman-installer.log


   Foreman结合mcollective

#登陆Web UI配置,设置 --> Puppet --> puppetrun 启用

sed -i 's/.*:puppet_provider:.*/:puppet_provider: mcollective/' /etc/foreman-proxy/settings.d/puppet.yml 

cat >> /etc/sudoers <<EOF
Defaults:foreman-proxy !requiretty
foreman-proxy ALL = NOPASSWD: /usr/bin/mco puppet runonce *
EOF