-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsite-accounts.yml
55 lines (47 loc) · 1.5 KB
/
site-accounts.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
---
- name: Manage SFDC acounts 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 acounts
include_tasks: manage-accounts.yml
vars:
customer_name: "{{ csv_item['Global Customer Name'] }}"
account_id: "{{ csv_item['Account ID'] }}"
opp_owner: "{{ csv_item['Opportunity Owner'] }}"
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"