Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 3391fb9b authored by David Delassus's avatar David Delassus
Browse files

:sparkles: add role `notify_teams`

parent b9519b2e
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ Content
:maxdepth: 1
check_service_catalog
tag_rps_vms
provision_docker_router
provision_docker_proxy
provision_docker_waf
......@@ -15,7 +16,7 @@ Content
provision_docker_httpbin
probe_healthchecks
probe_testurls
tag_rps_vms
notify_teams
Legacy
------
......
Notify Teams Channel
====================
This role will send a notification to a Teams Channel.
Usage
-----
.. code-block:: yaml
---
- name: My Playbook
hosts: localhost
connection: local
vars:
notify_teams_webhook_url: "{{ lookup('env', 'TEAMS_WEBHOOK_URL') }}"
roles:
- role: ec.rps_nginx.notify_teams
vars:
env_name: 'my-env-name'
notify_teams_webhook_template: !unsafe |
This is a message from the {{ env_name }} environment.
Inventory
---------
.. csv-table::
:header: "Key", "Description", "Default Value"
:widths: 20, 70, 10
"notify_teams_webhook_url", "URL to the Teams 'Incomming Webhook'", "N/A"
"notify_teams_webhook_template", "Jinja2 template to use to generate the webhook request body", "N/A"
---
notify_teams_webhook_url: ""
notify_teams_webhook_template: ""
---
- name: Send notification
ansible.builtin.uri:
url: "{{ teams_webhook }}"
method: POST
headers:
Content-Type: "application/json"
body: "{{ lookup('template', notify_teams_webhook_template) }}"
body_format: json
register: result
retries: 5
delay: 3
until: result is not failed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment