zabbix_agent.yml文件:
--- - hosts: zabbix-agent vars: - zabbix_server: 192.168.1.100 tasks: - name: add zabbix repo - Centos7 yum_repository: name: zabbix description: zabbix repo baseurl: http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/ gpgcheck: no enabled: 1 when: ansible_distribution == "CentOS" and ansible_distribution_major_version == ‘7‘ - name: add zabbix repo - Centos6 yum_repository: name: zabbix description: zabbix repo baseurl: http://repo.zabbix.com/zabbix/4.0/rhel/6/$basearch/ gpgcheck: no enabled: 1 when: ansible_distribution == "CentOS" and ansible_distribution_major_version == ‘6‘ - name: Install zabbix agent yum: name=zabbix-agent state=present - name: copy zabbix agent template: src=zabbix_agentd.conf.j2 dest=/etc/zabbix/zabbix_agentd.conf - name: start zabbix agent service: name=zabbix-agent state=started enabled=true
zabbix_agentd.conf.j2文件内容
PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log DebugLevel=3 Server={{ zabbix_server }} ListenPort=10050 ListenIP={{ ansible_default_ipv4.address }} ServerActive={{ zabbix_server }} Hostname={{ ansible_default_ipv4.address }} HostMetadataItem=system.uname Include=/etc/zabbix/zabbix_agentd.d/*.conf # UserParameter=
原文地址:https://www.cnblogs.com/zhangzihong/p/9829525.html
时间: 2024-10-10 03:46:44