Skip to content

Ansible module for sending periodic notifications on desktop.

License

Notifications You must be signed in to change notification settings

strboul/ansible-notify-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-notify-check

🚧 This module is still work in progress 🚧


Ansible module to send notifications periodically. Ideal for desktop environment setups.

The module uses notify-send to send the notification. Also, with timer part with systemd-timer, it can send time-based notifications.

Usage

parameter required type description
id yes str unique service and timer id.
condition no str condition to trigger this check. If condition field exists and if it's a truthy value, the check runs.
message no str message to display in the notifier. The bash variables are expanded.
options no dict a dictionary to define notify-send options.
options.urgency no str Specifies the urgency level (low, normal, critical).
options.icon no str icon file name from the locations $HOME/.icons, $HOME/.local/share/icons, /usr/local/share/icons, /usr/share/icons.
options.expire_time no int duration in milliseconds for the notification to appear on screen.
timer no dict a dictionary to define systemd-timer options.

Examples

- name: Check condition and notify
  strboul.notify.check:
    id: test
    condition: "[[ 1 == 1 ]]"
    message: |
      This notification is shown 1 minute after the boot and then every 5
      minutes after the first run.

      You can use shell parameter expansion.
      Lang is "$LANG".
      Now is "$(date)".

      Also ansible variables.
      Home is {{ ansible_env.HOME }}.
    options:
      urgency: critical
      icon: user-info
    timer:
      OnBootSec: 1min
      OnUnitActiveSec: 5min

Installation

ansible-galaxy install https://github.com/strboul/ansible-notify-check.git

Development

  • Bump the version in the galaxy.yml file.

Run tests

ansible-galaxy collection build .
ansible-galaxy collection install strboul-notify-*.tar.gz
ansible-playbook tests/*
# rm -rf ~/.ansible/collections/ansible_collections/strboul/notify

Debugging

python plugins/modules/check.py tests/args.json

About

Ansible module for sending periodic notifications on desktop.

Topics

Resources

License

Stars

Watchers

Forks

Languages