Simple Batch installation Zabbix_agent software

Source: Internet
Author: User

Record a batch installation zabbix_agent
 由于要安装的系统里面是其他组安装了openstack不想用他们的源来安装不知道什么版本的agent所以我就写一个简单的批量安装我们自己版本的zabbix_agent     知识点 ansible的一些命令,会点系统的都能看懂。    首先有这么几个文件和目录     hosts    readme.txt    roles    zabbix.yml先看readme.txt
直接运行,注意远程用户的修改ansible-playbook -i hosts zabbix.yml如果报错,rpm包已经安装就这样忽略rpm包的安装ansible-playbook -i hosts zabbix.yml  --skip-tags=rpm_yeshosts里面修改需要安装的机器列表如果是密钥连接eval `ssh-agent`ssh-add之后就可以运行了。
Inside the hosts is Ansible's list of inventory:ansible management hosts.
[Zabbix]
1.1.1.1
2.2.2.2
[AA]
3.3.3.3
4.4.4.4
And then it's Zabbiy.yml file.
  • Hosts:zabbix #这个就是指定要在那些机器上安装, corresponding in the hosts
    Remote_user:wuyantao #远程机器的用户 to be installed on the machine to have
    Sudo:yes #是否需要sudo because you want to install RPM so sudo
    VARs
    zabbix_serveractive:1.1.1.1 #定义变量 is the replacement of the value inside the agent.conf.
    zabbix_server:2.2.2.2
    Roles
    • Zabbix #指定执行的roles里面的那个
      And then you see the Zabbix content inside the roles, that's the installation.
      Mainly look at the MIAN.YML configuration within the task
  • Name:create-software
    File:path=/home/{{ansible_env. Sudo_user}}/software state=directory
    This is the creation of a directory to put some files needed to use

  • name:copy-rpm
    Copy:src={{item}} dest=/home/{{ansible_env. sudo_user}}/software/mode=0644
    With_items:

    • Scripts.tar.gz
    • zabbix-agent-3.2.6-1.el7.x86_64.rpm
    • Zabbix_agentd.tar.gz
    • zabbix-get-3.2.6-1.el7.x86_64.rpm
    • zabbix-sender-3.2.6-1.el7.x86_64.rpm
      Copy module is copying files into the directory
  • Name:shell
    Shell:rpm-ivh/home/{{ansible_env. Sudo_user}}/software/{{item}}
    With_items:

    • zabbix-agent-3.2.6-1.el7.x86_64.rpm
    • zabbix-get-3.2.6-1.el7.x86_64.rpm
    • zabbix-sender-3.2.6-1.el7.x86_64.rpm
      Tags:rpm_yes
      Shell module is to use the RPM command to install a specific package directly, if the error is already installed Rpm_zabbix package through tags can skip this name
  • Name:unarchive_scripts
    Unarchive:src=/home/{{ansible_env. sudo_user}}/software/scripts.tar.gz Dest=/etc/zabbix/copy=no mode=755
    Unarchive decompression module to a specific directory

  • name:copy files
    Copy:src={{item}} dest=/etc/zabbix/zabbix_agentd.d/mode=0644 Owner=root
    With_fileglob:

    • .. /templates/zabbix_agentd.d/*.conf
      Notify:restart zabbix-agent
      Also the copy module can actually be written together, but there is no Zabbix directory copy error if no RPM package is installed.
  • Name:start-zabbix-agent
    Service:name=zabbix-agent state=started Enabled=yes
    is to turn the service on and on, boot up, this can be set to the last

  • Name:copy-zabbix-agentd-conf
    Template:src=zabbix_agentd.conf.j2 dest=/etc/zabbix/zabbix_agentd.conf mode=0644
    Notify:restart zabbix-agent
    Modify configuration and restart

File download at http://down.51cto.com/data/2453090

Simple Batch installation Zabbix_agent software

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.