1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
# Zabbix collection for Ansible
Plugins:
![plugins](https://github.com/ansible-collections/community.zabbix/workflows/plugins-integration/badge.svg) ![repo-sanity](https://github.com/ansible-collections/community.zabbix/workflows/repo-sanity/badge.svg)
Roles:
![Zabbix Agent](https://github.com/ansible-collections/community.zabbix/workflows/community.zabbix.zabbix_agent/badge.svg) ![Zabbix Server](https://github.com/ansible-collections/community.zabbix/workflows/community.zabbix.zabbix_server/badge.svg) ![Zabbix Proxy](https://github.com/ansible-collections/community.zabbix/workflows/community.zabbix.zabbix_proxy/badge.svg) ![Zabbix Web](https://github.com/ansible-collections/community.zabbix/workflows/community.zabbix.zabbix_web/badge.svg) ![Zabbix Javagateway](https://github.com/ansible-collections/community.zabbix/workflows/community.zabbix.zabbix_javagateway/badge.svg)
**Table of Contents**
- [Zabbix collection for Ansible](#zabbix-collection-for-ansible)
* [Introduction](#introduction)
* [Included content](#included-content)
* [Installation](#installation)
+ [Requirements](#requirements)
+ [Installing the Collection from Ansible Galaxy](#installing-the-collection-from-ansible-galaxy)
+ [Upgrading collection](#upgrading-collection)
* [Usage](#usage)
* [Supported Zabbix versions](#supported-zabbix-versions)
* [Collection life cycle and support](#collection-life-cycle-and-support)
* [Contributing](#contributing)
* [License](#license)
## Introduction
This repo hosts the `community.zabbix` Ansible Collection.
The collection includes a variety of Ansible content to help automate the management of resources in Zabbix.
## Included content
Click on the name of a plugin or module to view that content's documentation:
- **Inventory Sources**:
- [zabbix](scripts/inventory/zabbix.py) - Zabbix Inventory Script
- [zabbix_inventory](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_inventory_inventory.html) - Zabbix Ansible Inventory Plugin
- **Modules**:
- [zabbix_action](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_action_module.html)
- [zabbix_authentication](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_authentication_module.html)
- [zabbix_autoregister](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_autoregister_module.html)
- [zabbix_discovery_rule](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_discovery_rule_module.html)
- [zabbix_globalmacro](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_globalmacro_module.html)
- [zabbix_group_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_group_info_module.html)
- [zabbix_group_events_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_group_events_info_module.html)
- [zabbix_group](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_group_module.html)
- [zabbix_host_events_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_host_events_info_module.html)
- [zabbix_host_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_host_info_module.html)
- [zabbix_host](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_host_module.html)
- [zabbix_hostmacro](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_hostmacro_module.html)
- [zabbix_housekeeping](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_housekeeping_module.html)
- [zabbix_maintenance](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_maintenance_module.html)
- [zabbix_map](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_map_module.html)
- [zabbix_mediatype](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_mediatype_module.html)
- [zabbix_proxy_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_proxy_info_module.html)
- [zabbix_proxy](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_proxy_module.html)
- [zabbix_screen](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_screen_module.html)
- [zabbix_script](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_script_module.html)
- [zabbix_service](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_service_module.html)
- [zabbix_template_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_template_info_module.html)
- [zabbix_template](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_template_module.html)
- [zabbix_user_info](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_user_info_module.html)
- [zabbix_user](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_user_module.html)
- [zabbix_usergroup](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_usergroup_module.html)
- [zabbix_valuemap](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_valuemap_module.html)
- **Roles**:
- [zabbix_agent](docs/ZABBIX_AGENT_ROLE.md)
- [zabbix_javagateway](docs/ZABBIX_JAVAGATEWAY_ROLE.md)
- [zabbix_proxy](docs/ZABBIX_PROXY_ROLE.md)
- [zabbix_server](docs/ZABBIX_SERVER_ROLE.md)
- [zabbix_web](docs/ZABBIX_WEB_ROLE.md)
## Installation
### Requirements
Each component in this collection requires additional dependencies. Review components you are interested in by visiting links present in the [Included content](#included-content) section.
This is especially important for some of the Zabbix roles that require you to **install additional standalone roles** from Ansible Galaxy.
For the majority of modules, however, you can get away with just:
#### Ansible 2.10 and higher
With the release of Ansible 2.10, modules have been moved into collections. With the exception of ansible.builtin modules, this means additonal collections must be installed in order to use modules such as seboolean (now ansible.posix.seboolean). The following collections are now frequently required: `ansible.posix` and `community.general`. Installing the collections:
```bash
ansible-galaxy collection install ansible.posix
ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.netcommon
```
### Installing the Collection from Ansible Galaxy
Before using the Zabbix collection, you need to install it with the Ansible Galaxy CLI:
```bash
ansible-galaxy collection install community.zabbix
```
You can also include it in a `requirements.yml` file along with other required collections and install them via `ansible-galaxy collection install -r requirements.yml`, using the format:
```yaml
---
collections:
- name: community.zabbix
version: 2.3.1
- name: ansible.posix
version: 1.3.0
- name: community.general
version: 3.7.0
```
### Upgrading collection
Make sure to read [UPGRADE](docs/UPGRADE.md) document before installing newer version of this collection.
## Usage
*Please note that these are not working examples. For documentation on how to use content included in this collection, refer to the links in the [Included content](#included-content) section.*
To use a module or role from this collection, reference them with their Fully Qualified Collection Namespace (FQCN) like so:
```yaml
---
- name: Using Zabbix collection to install Zabbix Agent
hosts: localhost
roles:
- role: community.zabbix.zabbix_agent
zabbix_agent_server: zabbix.example.com
...
- name: If Zabbix WebUI runs on non-default (zabbix) path, e.g. http://<FQDN>/zabbixeu
ansible.builtin.set_fact:
ansible_zabbix_url_path: 'zabbixeu'
- name: Using Zabbix collection to manage Zabbix Server's elements with username/password
hosts: zabbix.example.com
vars:
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 80
ansible_httpapi_use_ssl: false # Set to true for HTTPS
ansible_httpapi_validate_certs: false # For HTTPS et to true to validate server's certificate
ansible_user: Admin
ansible_httpapi_pass: zabbix
tasks:
- name: Ensure host is monitored by Zabbix
community.zabbix.zabbix_host:
...
- name: Using Zabbix collection to manage Zabbix Server's elements with authentication key
hosts: zabbix.example.net
vars:
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 80
ansible_httpapi_use_ssl: false # Set to true for HTTPS
ansible_httpapi_validate_certs: false # For HTTPS set to true to validate server's certificate
ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
tasks:
- name: Ensure host is monitored by Zabbix
community.zabbix.zabbix_host:
...
```
Or you include collection name `community.zabbix` in the playbook's `collections` element, like this:
```yaml
---
- name: Using Zabbix collection
hosts: localhost
collections:
- community.zabbix
roles:
- role: zabbix_agent
zabbix_agent_server: zabbix.example.com
...
- name: Using Zabbix collection to manage Zabbix Server's elements with username/password
hosts: zabbix.example.com
vars:
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 80
ansible_httpapi_use_ssl: false # Set to true for HTTPS
ansible_httpapi_validate_certs: false # For HTTPS et to true to validate server's certificate
ansible_user: Admin
ansible_httpapi_pass: zabbix
tasks:
- name: Ensure host is monitored by Zabbix
zabbix.zabbix_host:
...
- name: Using Zabbix collection to manage Zabbix Server's elements with authentication key
hosts: zabbix.example.net
vars:
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 80
ansible_httpapi_use_ssl: false # Set to true for HTTPS
ansible_httpapi_validate_certs: false # For HTTPS et to true to validate server's certificate
ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
tasks:
- name: Ensure host is monitored by Zabbix
community.zabbix.zabbix_host:
...
```
If Basic Authentication is required to access Zabbix server add following variables:
```
zabbix_api_http_user: "user"
zabbix_api_http_password: "password"
```
## Supported Zabbix versions
Main priority is to support Zabbix releases which have official full support from Zabbix LLC. Please checkout the versions at [Zabbix Life Cycle & Release Policy](https://www.zabbix.com/life_cycle_and_release_policy) page.
Support for Zabbix LTS versions will be dropped with Major releases of the collection and mostly affect modules. Each role is following its unique support matrix. You should always consult documentation of roles in *docs/* directory.
If you find any inconsistencies with the version of Zabbix you are using, feel free to open a pull request or an issue and we will try to address it as soon as possible. In case of pull requests, please make sure that your changes will not break any existing functionality for currently supported Zabbix releases.
## Collection life cycle and support
See [RELEASE](docs/RELEASE.md) document for more information regarding life cycle and support for the collection.
## Contributing
See [CONTRIBUTING](CONTRIBUTING.md) for more information about how to contribute to this repository.
Please also feel free to stop by our [Gitter community](https://gitter.im/community-zabbix/community).
## License
GNU General Public License v3.0 or later
See [LICENSE](LICENSE) to see the full text.
|