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模塊簡單粗暴。