ansible 部署 zabbix客户端 脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible 部署 zabbix客户端 脚本相关的知识,希望对你有一定的参考价值。

[[email protected] ~]# tree ansible
ansible
├── get-pip.py
├── hosts
├── roles
│   └── zabbix
│       ├── default
│       ├── files
│       │   ├── tcp_status.conf
│       │   ├── tcp_status.log
│       │   └── tcp_status.sh
│       ├── handlers
│       ├── meta
│       ├── tasks
│       │   └── main.yml
│       ├── template
│       └── vars
│           └── main.yml
├── site.retry
└── site.yml
9 directories, 9 files
[[email protected] ~]# 

[[email protected] ~]# cat  roles/zabbix/tasks/main.yml 
- name: 拷贝tcp的脚本tcp_status.sh
  copy: src=tcp_status.sh dest={{ destsh }}  mode=755  force=yes
- name: 拷贝tcp的配置文件tcp_status.conf
  copy: src=tcp_status.conf dest={{ destconf }}  force=yes
- name: 创建目录{{ createdir }} 
  file: dest={{ createdir }} state=directory  force=no
- name: 拷贝临时文件 tcp_status.log  权限zabbix
  copy: src=tcp_status.log dest={{ createdir }} mode=644  force=yes  owner=zabbix group=zabbix
- name: 重启 zabbix 客户端
  service: name=zabbix-agent state=restarted
[[email protected] ~]# 



[[email protected] ~]# cat  hosts 
[efield]
e0
e1
e2
e3
e4
[[email protected] ~]# 


[[email protected] ansible]# cat site.yml 
---
- name: Install zabbix   template
  hosts: next
  become: True
  roles:
    - zabbix
[[email protected] ansible]# 




[[email protected] ansible]# cat  roles/zabbix/vars/main.yml 
destsh: /etc/zabbix/shell/
destconf: /etc/zabbix/zabbix_agentd.d/
createdir: /etc/zabbix/data/
[[email protected] ansible]#

本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1906430

以上是关于ansible 部署 zabbix客户端 脚本的主要内容,如果未能解决你的问题,请参考以下文章

zabbix系列之使用ansible批量部署zabbix客户端

ansible自动化部署zabbix客户端

ansible部署zabbix客户端

Ansible 部署 Zabbix 客户端

ansible-playbook批量部署zabbix

ansible自动部署 zabbix-agent 的模块