ansible-role-zabbix-server/roles/zabbix_server/tasks/templates.yml
2024-10-22 18:19:12 -05:00

130 lines
4.0 KiB
YAML

# github https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates?at=refs%2Fheads%2Frelease%2F6.4
---
- name: Crear la carpeta de destino si no existe
file:
path: /usr/share/agofer/repositorio_zabbix
state: directory
mode: '0755'
#- name: Clonar el repositorio de GitHub con profundidad 1
# command: git clone --depth=1 https://git.zabbix.com/scm/zbx/zabbix.git /home/sistemas/repositorio_zabbix
# args:
# creates: /home/sistemas/repositorio_zabbix/.git
#
#- name: Crear la carpeta de destino en el directorio del rol si no existe
# file:
# path: "{{ role_path }}/files"
# state: directory
# mode: '0755'
#
#- name: Mover el contenido del repositorio al directorio del rol
# copy:
# src: "{{ item }}"
# dest: "{{ role_path }}/files/"
# remote_src: yes
# with_fileglob:
# - "/home/sistemas/repositorio_zabbix/*"
#
#- name: Limpiar directorios temporales
# file:
# path: /home/sistemas/repositorio_zabbix
# state: absent
#- name: Import Zabbix templates from JSON
# # set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# community.zabbix.zabbix_template:
# template_json: "{{ lookup('file', 'zabbix_apache2.json') }}"
# state: present
#- name: Import Zabbix templates from XML
# set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# zabbix_template:
# template_xml: "{{ lookup('file', 'zabbix_apache2.xml') }}"
# state: present
#- name: Import Zabbix template from Ansible dict variable
# set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# zabbix_template:
# template_json:
# zabbix_export:
# version: "3.2"
# templates:
# - name: Template for Testing
# description: "Testing template import"
# template: Test Template
# groups:
# - name: Templates
# state: present
#
#- name: Configure macros on the existing Zabbix template
# # set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# zabbix_template:
# template_name: Template
# macros:
# - macro: "{$TEST_MACRO}"
# value: "Example"
# state: present
#
#- name: Add tags to the existing Zabbix template
# set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# zabbix_template:
# template_name: Template
# tags:
# - tag: class
# value: application
# state: present
#
#- name: Delete Zabbix template
# set task level variables as we change ansible_connection plugin here
# vars:
# ansible_network_os: community.zabbix.zabbix
# ansible_connection: httpapi
# ansible_httpapi_port: 80
# ansible_httpapi_use_ssl: false
# ansible_httpapi_validate_certs: false
# ansible_zabbix_url_path: ''
# become: False
# zabbix_template:
# template_name: Template
# state: absent