notification/README.md

56 lines
993 B
Markdown
Raw Normal View History

2023-02-17 12:51:03 +03:00
# notification
2023-02-18 09:22:41 +03:00
Install E-Mail/Telegram notifications
## Dependencies
> - Python 3.9 or above on inventory hosts (in repo on Debian | from sources in /usr/local/bin on CentOS)
## Download a Role
2023-12-19 22:21:05 +03:00
2023-02-18 09:22:41 +03:00
```bash
wget -qO- https://git.hmp.today/pavel.muhortov/notification/archive/master.tar.gz | tar -xvz -C .
```
## Edit Role Variables
2023-12-19 22:21:05 +03:00
2023-02-18 09:22:41 +03:00
```yaml
# nano ./notification/vars/main.yml
sendmail_smtp: smtp.host.zone
sendmail_port: 587
sendmail_from: user@host.zone
sendmail_pass: pass
sendmail_dest: user@host.zone
2023-12-19 22:21:05 +03:00
sendtelegram_api_key: YOURAPIKEY
sendtelegram_silence: true
## single chat
sendtelegram_chat_id: 123456789
## chat topics
sendtelegram_chat_id: -100123456789
sendtelegram_thrd_id: 123
2023-02-18 09:22:41 +03:00
```
## Create Playbook Example
2023-12-19 22:21:05 +03:00
2023-02-18 09:22:41 +03:00
```yaml
tee ./notification.yml > /dev/null <<'EOF'
- name: Install E-Mail/Telegram notification
hosts: all
become: yes
roles:
- notification
EOF
```
## Run Playbook
2023-12-19 22:21:05 +03:00
2023-02-18 09:22:41 +03:00
```bash
ansible-playbook ./notification.yml
```
## Clean
2023-12-19 22:21:05 +03:00
2023-02-18 09:22:41 +03:00
```bash
rm -rf ./notification*
```