-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
109 lines (91 loc) · 4.13 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
#####################################################################################################
#
# Usage:
#
# ansible-playbook main.yml -e "deployment_env=aabg"
# ansible-playbook main.yml -e "deployment_env=non-prod"
# ansible-playbook main.yml -e "deployment_env=prod"
#
# ansible-playbook main.yml -e "deployment_env=aabg nocyberark=1"
# ansible-playbook main.yml -e "deployment_env=non-prod nocyberark=1"
# ansible-playbook main.yml -e "deployment_env=prod nocyberark=1"
#
#####################################################################################################
- hosts: localhost
remote_user: root
vars:
- deployment_env: "aabg" # must be overwritten with an inline variable. eg: ... -e "deployment_env=non-prod"
tasks:
- include_vars: "./environments/{{ deployment_env }}/vars_specific.yml" # variables specific to wdl-gcs-ingestion
- include_vars: "./environments/{{ deployment_env }}/main.yml" # tags used in wdl-gcs-ingestion
- include_vars: "./environments/{{ deployment_env }}/vars_tags.yml" # tags used in wdl-gcs-ingestion
- include_vars: "./environments/vars_common.yml" # common vars same in all environments
- block:
#######################################################################################################
- include_role:
name: ws----configure-aws # not executed if nocyberark is
#######################################################################################################
# prepare IAM roles, S3 buckets and files for this project
# create iam roles
- import_role:
name: iam-create
vars:
iam_role_stack_name: "{{ application_prefix }}-{{ deployment_env_short }}-iam-role-stack"
iam_role_parameter: "{{ default_glue_iam_role_name }}"
# create s3 buckets
- include_role:
name: s3-bucket
vars:
s3_stack_name: "{{ item_s3_bucket }}-stack"
s3_bucket_name: "{{ item_s3_bucket }}"
loop:
- "{{ default_s3_bucket }}"
- "{{ default_landingzone_bucket }}"
- "{{ default_proczone_bucket }}"
- "{{ default_curatedzone_bucket }}"
loop_control:
loop_var: item_s3_bucket
- name: copy files to s3
s3_sync:
bucket: "{{ default_landingzone_bucket }}"
file_root: "{{ playbook_dir }}/artifacts/legislators"
key_prefix: "legislators"
# #######################################################################################################
# deploy: Glue database, crawler and job
- import_role:
name: glue-database
vars:
glue_database_stack_name: "{{ glue_database_name }}-stack"
glue_database_name: "{{ glue_database_name }}"
- import_role:
name: glue-crawler
vars:
glue_crawler_stack_name: "{{ glue_crawler_name }}-stack"
glue_iam_role: "{{ default_glue_iam_role }}"
crawler_name: "{{ glue_crawler_name }}"
s3_targets_location: "{{ glue_crawler_s3_location }}"
glue_database_name: "{{ glue_database_name }}"
# # start glue crawler
# - name: start glue job
# shell: "aws glue start-crawler --name {{ crawler_name }}"
# register: shell_result
- import_role:
name: glue-job
vars:
glue_job_stack_name: "{{ application_prefix }}-{{ deployment_env_short }}-glue-job-stack"
glue_iam_role: "{{ default_glue_iam_role }}"
glue_job_name: "{{ glue_job_name }}"
glue_worker_type: "G.2X"
glue_number_workers: 10
- name: start the glue job
shell: "aws glue start-job-run --job-name {{ glue_job_name }}"
register: shell_result
- debug:
msg: "{{ shell_result }}"
always:
#######################################################################################################
- name: clean up
include_role:
name: ws----cleanup-aws # not executed if nocyberark is defined
#######################################################################################################