修改Hostname值

Published on with 0 views and 0 comments
#!/bin/bash 

hostname=`hostname`
old_hostname=`grep -Ev '^$|^#' /etc/zabbix/zabbix_agentd.conf  | grep Hostname`
sed -i "s#$old_hostname#Hostname=$hostname#g" /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent

下发:

ansible -i hosts.work  new-openstack  -m shell -a "netstat -lntup | grep 10050"
ansible -i hosts.work  new-openstack-ceph  -m shell -a "cat /etc/zabbix/zabbix_agentd.conf | grep 172.24.15.122"
ansible -i hosts.work  new-openstack -m copy -a "src=/root/test.sh dest=/tmp/test.sh"
ansible -i hosts.work  new-openstack  -m shell -a "sh /tmp/test.sh"

标题:修改Hostname值
作者:cuijianzhe
地址:https://solo.cjzshilong.cn/articles/2022/06/13/1655119738860.html

到头来 我们记住的 不是敌人的攻击 而是朋友的沉默 ---马丁·路德·金