zabbix ajout auto

This commit is contained in:
root 2024-01-20 17:19:38 +01:00
parent eaf75de89e
commit d75f4ffb3f
3 changed files with 10 additions and 3 deletions

View File

@ -1,2 +1,3 @@
SERVER: "127.0.0.1"
SERVERACTIVE: "172.16.0.8"
SERVERACTIVE: "192.168.99.8"
TOKENAPI: "f72473b7e5402a5247773e456f3709dcdd5e41792360108fc3451bbfeed8eafe"

View File

@ -28,6 +28,11 @@
state: restarted
enabled: yes
#- name: remonter les machines
#command: curl -X POST -H "Content-Type: application/json" -d '{ "jsonrpc":"2.0","method":"host.create","params": {"host": "s-itil","groups": [{"groupid": "6"}],"templates": [{"templateid": "10343"}],"inventory_mode": 0,"inventory": {"type": 0}},"auth": "a44e2a4977d61a869437739cb6086ae42f4b9937fbb96aed24bbad028469a1cf","id": 1}' http://192.168.99.8/zabbix/api_jsonrpc.php
- name: mise ne place script hostcreate
template:
src: hostcreate.sh.j2
dest: /tmp/hostcreate.sh
- name: lancement script hostcreate
command: bash /tmp/hostcreate.sh

View File

@ -0,0 +1 @@
curl -X POST -H "Content-Type: application/json" -d '{ "jsonrpc":"2.0","method":"host.create","params": {"host": "{{ ansible_hostname }}","groups": [{"groupid": "6"}],"templates": [{"templateid": "10343"}],"inventory_mode": 0,"inventory": {"type": 0}},"auth": "{{ TOKENAPI }}","id": 1}' http://{{ SERVERACTIVE }}/zabbix/api_jsonrpc.php