#!/bin/bash

#plugin 파일 수정 후
source /root/mos/puppet/plugins/param_plugin_path.sh
source /root/mos/puppet/plugins/sync_plugin_with_fuel_master.sh

#cd /root/mos
#git pull


#config.pp for controller
for i in `fuel node | grep ready | grep controller | cut -f 5 -d '|'`;
do
	rsync -av /root/mos/puppet/plugins/zabbix_monitoring-2.5/deployment_scripts/puppet/ ${i}:/etc/fuel/plugins/zabbix_monitoring-2.5/puppet/; 
	ssh ${i} "puppet apply /etc/fuel/plugins/zabbix_monitoring-2.5/puppet/manifests/zabbix_server_config.pp --modulepath=/etc/puppet/modules:/etc/fuel/plugins/zabbix_monitoring-2.5/puppet/modules --logdest /var/log/puppet.log --logdest /dev/stdout --debug";
done;

#agent.pp for all nodes
for i in `fuel node | grep ready | cut -f 5 -d '|'`; 
do 
	rsync -av /root/mos/puppet/plugins/zabbix_monitoring-2.5/deployment_scripts/puppet/ ${i}:/etc/fuel/plugins/zabbix_monitoring-2.5/puppet/; 
	ssh ${i} "puppet apply /etc/fuel/plugins/zabbix_monitoring-2.5/puppet/manifests/agent.pp --modulepath=/etc/puppet/modules:/etc/fuel/plugins/zabbix_monitoring-2.5/puppet/modules --logdest /var/log/puppet.log --logdest /dev/stdout --debug";
done;
