= notificaciones
== 3:35 Notificaciones
sistemas de mensajería:
* cisco_spark
* flowdock
* hipchat
* irc
* jabber
* mattermost : tipo **slack** pero de código abierto
* mqt : mensajería IoT
* nexmo : SMS
* pushbullet : móbiles
* pushover : móbiles
* rocketchat
* sendgrid
* slack
* sns : Simple Notification Service Amazon
* telegram
* twilo
=== hipchat
[[https://docs.ansible.com/ansible/latest/modules/hipchat_module.html#hipchat-module]]
* requeridos
* token
* msg
* room
* opcional
* api
* color
* from
* msg_format = { text | html }
* notify = yes / no
* validate_certs = YES / no
---
- hosts: localhost
connection: localhost
vars:
- notificar: "hipchat"
tasks:
- hipchat:
api: https://api.hipchat.com/v2/
token: "..."
room: destinatario
msg: "Tarea finalizada"
when: notificar == "hipchat"
- mail:
subject: "Tarea finalizada"
delegate_to: localhost
when: notificar == "mail"
- pip: name=pushbullet.py
when: notificar == "pushbullet"
=== mail
[[https://docs.ansible.com/ansible/latest/modules/mail_module.html#mail-module]]
* requerido
* subject
* opcional
* host
* port
* user
* password
* to
* body
* cc
* bcc
* secure = { always | never | try | starttls }
---
- hosts: localhost
connection: localhost
vars:
- notificar: "mail"
tasks:
- mail:
subject: "Tarea finalizada"
host: servidor.correo
port: 25
to: alberto@correo
delegate_to: localhost
when: notificar == "mail"
=== pushbullet
[[https://docs.ansible.com/ansible/latest/modules/pushbullet_module.html#pushbullet-module]]
* requerido
* api_key
* title
* opcional
* body
* channel
* device
* push_type
---
- hosts: localhost
connection: localhost
vars:
- notificar: "pushbullet"
tasks:
- name: instalar pushbullet.py
pip: name=pushbullet.py state=latest
when: notificar == "pushbullet"
- name: enviar notificación
pushbullet:
api_key:
device:
title: "Notificación Ansible"
when: notificar == "pushbullet"
=== pushover
[[https://docs.ansible.com/ansible/latest/modules/pushover_module.html#pushover-module]]
* requeridos
* app_token
* user_key
* msg
* opcional
* pri = prioridad
=== rocketchat
[[https://docs.ansible.com/ansible/latest/modules/rocketchat_module.html#rocketchat-module]]
* requeridos:
* token
* domain
* opcional
* mdg
* channel
* username
* color = { normal | good | warning | danger }
* protocol = { https | http }
* validate_certs = true /false
=== slack
[[https://docs.ansible.com/ansible/latest/modules/slack_module.html#slack-module]]
* requerido
* token
* opcional
* msg
* channel = #canal
* username
* color = { normal | good | warning | danger }
* validate_certs = true / false