Taula de continguts

notificaciones

3:35 Notificaciones

sistemas de mensajería:

hipchat

https://docs.ansible.com/ansible/latest/modules/hipchat_module.html#hipchat-module

---
- 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

---
- 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

---
- 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: <clave>
          device: <dispositivo>
          title: "Notificación Ansible"
        when: notificar == "pushbullet"

pushover

https://docs.ansible.com/ansible/latest/modules/pushover_module.html#pushover-module

rocketchat

https://docs.ansible.com/ansible/latest/modules/rocketchat_module.html#rocketchat-module

slack

https://docs.ansible.com/ansible/latest/modules/slack_module.html#slack-module