Skip to content

Commit

Permalink
Tuning notification playbooks to allow for single user notification (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oybed authored Dec 1, 2021
1 parent 748337d commit daf78b8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
17 changes: 5 additions & 12 deletions playbooks/notifications/email-notify-single-user.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
---

- include_vars:
file: "{{ email_content_file }}"
when:
- email_content_file is defined
- set_fact:
markdown_content: "{{ body }}"
- include_role:
name: notifications/md-to-html
- set_fact:
mail: "{{ mail | combine( {'subject': title, 'body': md_to_html.html_body_message, 'to': email_to} ) }}"
- include_role:
name: notifications/send-email
- name: "Send HTML e-mail message to a single user"
hosts: mail-host
gather_facts: no
tasks:
- include_tasks: email-notify-tasks.yml

15 changes: 15 additions & 0 deletions playbooks/notifications/email-notify-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

- include_vars:
file: "{{ email_content_file }}"
when:
- email_content_file is defined
- set_fact:
markdown_content: "{{ body }}"
- include_role:
name: notifications/md-to-html
- set_fact:
mail: "{{ mail | combine( {'subject': title, 'body': md_to_html.html_body_message, 'to': email_to} ) }}"
- include_role:
name: notifications/send-email

2 changes: 1 addition & 1 deletion playbooks/notifications/email-notify-users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
hosts: mail-host
gather_facts: no
tasks:
- include_tasks: email-notify-single-user.yml
- include_tasks: email-notify-tasks.yml
vars:
first_name: "{{ item.first_name }}"
user_name: "{{ item.user_name }}"
Expand Down

0 comments on commit daf78b8

Please sign in to comment.