🚧 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.
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. |
- 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
ansible-galaxy install https://github.com/strboul/ansible-notify-check.git
- Bump the
version
in thegalaxy.yml
file.
ansible-galaxy collection build .
ansible-galaxy collection install strboul-notify-*.tar.gz
ansible-playbook tests/*
# rm -rf ~/.ansible/collections/ansible_collections/strboul/notify
python plugins/modules/check.py tests/args.json