-
Notifications
You must be signed in to change notification settings - Fork 2
/
site.yml
75 lines (67 loc) · 2.59 KB
/
site.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
- name: Manage SFDC opportunities as Asana tasks
hosts: localhost
gather_facts: false
vars_files:
- group_vars/all.yml
pre_tasks:
- set_fact:
num_ops: "{{ csvopps.list|count }}"
tasks:
- name: Log project_gid
debug:
var: project_gid
failed_when: project_gid is not defined
- name: Get a list of tasks in a project ({{ project_gid }})
uri:
url: "{{ asana_api }}/projects/{{ project_gid }}/tasks"
headers:
Content-Type: application/json
Authorization: "{{ asana_token }}"
method: GET
validate_certs: "{{ validate_certs }}"
status_code: 200
register: project_tasks
- name: Log project_tasks
debug:
var: project_tasks
verbosity: 2
failed_when: project_tasks is not defined
- name: Count number of tasks found
debug:
var: project_tasks.json.data | count
failed_when: project_tasks is not defined
- name: Convert dict to list and Loop through each item to manage tasks
include_tasks: manage-tasks.yml
vars:
close_date: "{{ csv_item['Close Date'] }}"
created_date: "{{ csv_item['Created Date'] }}"
customer_name: "{{ csv_item['Global Customer Name'] }}"
description: "{{ csv_item['Description'] | default('') }}"
fiscal_quarter: "{{ csv_item['Fiscal Quarter'] }}"
forecast_category: "{{ csv_item['Forecast Category'] }}"
next_step: "{{ csv_item['Next Step'] | default('') }}"
opp_id: "{{ csv_item['Opportunity ID'] }}"
opp_number: "{{ csv_item['Opportunity Number'] }}"
opp_name: "{{ csv_item['Opportunity Name'] }}"
opp_owner: "{{ csv_item['Opportunity Owner'] }}"
opp_record_type: "{{ csv_item['Opportunity Record Type'] }}"
products: "{{ csv_item['Products'] }}"
syb: "{{ csv_item['1st Year Booking'] }}"
tb: "{{ csv_item['Total Amount'] }}"
stage: "{{ csv_item['Stage'] }}"
tech_win_date: "{{ csv_item['Technical Win Date'] }}"
reason1: "{{ csv_item['Reason Closed/Lost'] }}"
reason2: "{{ csv_item['Reason Won/Lost (Sales Process)'] }}"
channel: "{{ csv_item['Channel'] }}"
reseller: "{{ csv_item['Reseller'] }}"
leadsource: "{{ csv_item['Lead Source'] }}"
distributor: "{{ csv_item['Financial Partner'] }}"
loop: "{{ csvopps.list }}"
loop_control:
loop_var: csv_item
index_var: csv_index
# count number of opportunities processed
- name: Play Summary
debug:
msg: "Processed {{ csvopps.list|count }} opps"