-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
35 lines (32 loc) · 1.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: Send notification message via Slack
hosts: localhost
gather_facts: no
vars:
response_file: "{{ lookup('file','./response.json') | from_json }}"
slack_username: "Zendesk Reporter"
tasks:
- name: Run Report python script
script: ./ZendeskReport.py {{ customerSearch }} {{ bearerToken }}
register: zendeskReport
- debug: var=zendeskReport.stdout_lines
- name: Send main to slack
slack:
token: T31GN34R3/BGS668SEL/lFuQQDJvNp1xUAipdHh74sHI
msg: Zendesk Report for "{{ customerSearch }}"
icon_emoji: ":zap:"
username: "{{ slack_username }}"
- name: Send tickets to Slack
slack:
token: T31GN34R3/BGS668SEL/lFuQQDJvNp1xUAipdHh74sHI
attachments:
- fallback: "Zendesk Search"
color: "#36a64f"
title: "{{ item.ticketID }}"
title_link: "https://t3n.zendesk.com/agent/tickets/{{ item.ticketID }}"
fields:
- title: "{{ item.ticketSubject }}"
value: "Status: {{ item.ticketStatus }}"
icon_emoji: ":zap:"
username: "{{ slack_username }}"
with_items: response_file.tickets