ansible实现zabbix-server的搭建

node1:192.168.91.139:zabbix-server
node2:192.168.91.137:ansible

在node2:

实现各主机间ssh无密钥通信
[root@localhost ~]#ssh-key

[root@localhost ~]#ssh-copy-id root@192.168.91.137

[root@localhost ~]#ls .ssh/
authorized_keys  id_rsa  id_rsa.pub  known_hosts

[root@localhost ~]#scp -r .ssh/* 192.168.91.139:~/.ssh/

安装ansible
[root@localhost ~]#yum install -y ansible

创建主机清单
[root@localhost ~]#vim /etc/ansible/hosts 
	[zabbixsrv]
	192.168.91.139

测试
[root@localhost ~]#ansible zabbixsrv -m ping
192.168.91.139 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

生成roles文件
[root@localhost ~]#mkdir /etc/ansible/roles/zabbixsrv/{files,templates,tasks,handlers,vars,defaults,meta} -pv

[root@localhost ~]#tree /etc/ansible/
/etc/ansible/
├── ansible.cfg
├── hosts
└── roles
    └── zabbixsrv
        ├── defaults
        ├── files
        ├── handlers
        ├── meta
      
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值