zoukankan      html  css  js  c++  java
  • ansible批量安装zabbix_agent && 修改配置文件

    Ansible常用指令

     

     

    rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

    rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm

     

     

    yum install zabbix-agent -y

     

    vi /etc/zabbix/zabbix_agentd.conf

     

     

     

     

    ServerActive=127.0.0.1

     

    Hostname=Zabbix server

    Server=127.0.0.1

     

    zabbix-agent部署

    ansible dev3 -m shell -a ‘’     查看配置可用shell模块

    ansible dev3 -m lineinfile -a 'path=/etc/zabbix/zabbix_agentd.conf regexp="^ServerActive=" line="ServerActive=172.17.31.76:10051"'    替换远程文件内容

    ansible dev3 -m lineinfile -a 'path=/etc/zabbix/zabbix_agentd.conf regexp="^Server=" line="Server=127.0.0.1,172.17.31.76"'      替换远程文件内容

     

    Copy  script  yum vars 等常用模块,适用yml文件

    命令行直接使用shell模块简单粗暴。

     

     

     

     

  • 相关阅读:
    BZOJ 4503: 两个串 FFT
    [FJOI2014]最短路径树问题
    [JSOI2009]游戏Game
    bzoj 2463 [中山市选2009]谁能赢呢?
    [CQOI2007]余数求和
    [NOI2011]兔兔与蛋蛋游戏
    [HNOI2015]实验比较
    bzoj2125 最短路
    [COGS 2877]老m凯的疑惑
    [HNOI2015]开店
  • 原文地址:https://www.cnblogs.com/mybxy/p/10312911.html
Copyright © 2011-2022 走看看