MCollective 安装配置(puppet 5.x)

activemq 安装

1. 安装activemq
下载  apache-activemq-5.15.2-bin.tar.gz 后解压到安装目录即可

tar zxvf activemq-5.15.2-bin.tar.gz

2. 配置activemq
使用官方例子配置文件

https://raw.github.com/puppetlabs/marionette-collective/master/ext/activemq/examples/single-broker/activemq.xml

查看actvie环境变量

./activemq list

ACTIVEMQ_HOME: /data/apache-activemq-5.15.2
ACTIVEMQ_BASE: /data/apache-activemq-5.15.2
ACTIVEMQ_CONF: /data/apache-activemq-5.15.2/conf
ACTIVEMQ_DATA: /data/apache-activemq-5.15.2/data
Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO: Broker not available at: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

3. 启动activemq
前台方式启动

cd [activemq_install_dir]/bin
  ./activemq console

后台方式启动

cd [activemq_install_dir]/bin
  ./activemq start

mcollective 安装

1. 在puppet5.x版本中 mcollective 已经随puppet安装,无需另外安装。

2. mcollective server 配置

vi /etc/puppetlabs/mcollective/client.cfg
main_collective = mcollective
collectives = mcollective

libdir = /opt/puppetlabs/mcollective/plugins

# consult the "classic" libdirs too
libdir = /usr/share/mcollective/plugins
libdir = /usr/libexec/mcollective

logfile = /var/log/puppetlabs/mcollective/mcollective.log
loglevel = debug
daemonize = 1

# Plugins
securityprovider = psk
plugin.psk = unset

connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = centos2
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = mcollective
plugin.activemq.pool.1.password = marionette

# Facts
factsource = yaml
plugin.yaml = /etc/puppetlabs/mcollective/facts.yaml

3. mcollective client 配置

vi /etc/puppetlabs/mcollective/client.cfg
main_collective = mcollective
collectives = mcollective

libdir = /opt/puppetlabs/mcollective/plugins

# consult the "classic" libdirs too
libdir = /usr/share/mcollective/plugins
libdir = /usr/libexec/mcollective

logger_type = console
loglevel = warn

# Plugins
securityprovider = psk
plugin.psk = unset

connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = centos2
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = mcollective
plugin.activemq.pool.1.password = marionette

connection_timeout = 3

4. 启动mcollective服务
# 启动

systemctl start mcollective

# 设为开机自动启动

systemctl enable mcollective

# log路径

/var/log/puppetlabs/mcollective/mcollective.log

# 测试命令

/opt/puppetlabs/puppet/bin/mco ping

插件安装

下载地址 https://github.com/puppetlabs/mcollective-plugins

shell插件 https://github.com/kisspuppet/mcollective-plugins

将下载的插件代码复制到下面路径

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/mcollective/

 

非root用户执行

1. 创建用户mcollective

useradd -c MCO  -r -b /var/lib -M -s /sbin/nologin mcollective

2. 创建主目录

mkdir /var/lib/mcollective
chown mcollective /var/lib/mcollective
chmod 750 /var/lib/mcollective

3. 准备配置文件

cd /var/lib/mcollective
cp /etc/puppetlabs/mcollective/server.cfg .
chown mcollective server.cfg
vi server.cfg

#puppet配置文件

非root用户执行时必须配置在 ~/.puppetlabs/etc/puppet 目录下配置相关文件, 否则mco调用puppetd时会失败

cp -r /etc/puppetlabs/puppet/* /var/lib/mcollective/.puppetlabs/etc/puppet

#server.cfg文件内容如下

main_collective = mcollective
collectives = mcollective

# consult the "classic" libdirs too
libdir = /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/mcollective:/usr/share/mcollective/plugins

logfile = /var/log/mcollective/mcollective.log
loglevel = debug
daemonize = 1

# Plugins
securityprovider = psk
plugin.psk = unset

connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = centos2
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = mcollective
plugin.activemq.pool.1.password = marionette

# Facts
factsource = yaml
plugin.yaml = /etc/puppetlabs/mcollective/facts.yaml

#创建log文件路径

mkdir /var/log/mcollective
chown mcollective /var/log/mcollective

4. 修改service文件

vi /usr/lib/systemd/system/mcollective.service

在[Service]下添加User=mcollective,并修改configfile和pidfile的路径。文件内容如下:

[Unit]
Description=The Marionette Collective
After=network.target

[Service]
User=mcollective
Type=forking
StandardOutput=syslog
StandardError=syslog
ExecStart=/opt/puppetlabs/puppet/bin/mcollectived --config=/var/lib/mcollective/server.cfg --pidfile=/var/lib/mcollective/mcollective.pid --daemonize
ExecReload=/bin/kill -USR1 $MAINPID
PIDFile=/var/lib/mcollective/mcollective.pid
KillMode=process

[Install]
WantedBy=multi-user.target

重新载入service文件

 systemctl daemon-reload

5. 启动mcollective

systemctl start mcollective

mcollective 配置项说明

https://puppet.com/docs/mcollective/current/configure/server.html

https://puppet.com/docs/mcollective/current/configure/client.html

 

转载于:https://my.oschina.net/u/3776771/blog/1616723

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值