Skip to content

Commit 807cb79

Browse files
committed
Add hooks before and after all sections.
1 parent 6976c86 commit 807cb79

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ php_telegram_bot_bots: []
8686

8787
Available fields for `php_telegram_bot_bots` entry are the ones available for the [PHP Telegram Bot Manager][php-telegram-bot-manager]. Simply use YAML format to define variables in the same structure as the [`manager.php`][manager.php-example] parameters array.
8888

89+
## Role Hooks
90+
91+
This role has hooks before and after each section.
92+
93+
```yaml
94+
php_telegram_bot_hooks_before_install: my-hook.yml
95+
php_telegram_bot_hooks_after_install: my-hook.yml
96+
php_telegram_bot_hooks_before_database: my-hook.yml
97+
php_telegram_bot_hooks_after_database: my-hook.yml
98+
php_telegram_bot_hooks_before_webhook: my-hook.yml
99+
php_telegram_bot_hooks_after_webhook: my-hook.yml
100+
```
101+
89102
## Role Tags
90103
91104
Each part of the setup has a tag.

tasks/empty.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# This is a placeholder for an empty hook task.

tasks/main.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
---
2-
- include: install.yml
2+
- block:
3+
- include: "{{ php_telegram_bot_hooks_before_install | default('empty.yml') }}"
4+
- include: install.yml
5+
- include: "{{ php_telegram_bot_hooks_after_install | default('empty.yml') }}"
36
tags: php-telegram-bot:install
4-
- include: database.yml
7+
8+
- block:
9+
- include: "{{ php_telegram_bot_hooks_before_database | default('empty.yml') }}"
10+
- include: database.yml
11+
- include: "{{ php_telegram_bot_hooks_after_database | default('empty.yml') }}"
512
tags: php-telegram-bot:database
6-
- include: webhook.yml
13+
14+
- block:
15+
- include: "{{ php_telegram_bot_hooks_before_webhook | default('empty.yml') }}"
16+
- include: webhook.yml
17+
- include: "{{ php_telegram_bot_hooks_after_webhook | default('empty.yml') }}"
718
tags: php-telegram-bot:webhook

0 commit comments

Comments
 (0)