-
Notifications
You must be signed in to change notification settings - Fork 3
/
CKAN-Stack.yml
70 lines (57 loc) · 1.9 KB
/
CKAN-Stack.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
---
- name: Cloudformation Playbook
hosts: local
connection: local
pre_tasks:
- name: get basic_facts
set_fact:
basic_fact={{ item }}
# CKANSource={{ item.CKANSource }}
when: item.Environment == Environment
with_items: "{{ basic_facts }}"
- name: set facts to environment from basic_fact
set_fact: "{{ item.key }}={{ item.value }}"
with_dict: "{{ basic_fact }}"
when: basic_fact is defined
- set_fact:
acm_stack_name: "{{ service_name }}-{{ Environment }}-acm"
- name: Describe acm cert cloudformation stack in default region
cloudformation_facts:
region: "{{ region }}"
stack_name: "{{ acm_stack_name }}"
stack_resources: true
register: acm
- set_fact:
ACMCertificateARNForDefaultRegion: "{{ acm.ansible_facts.cloudformation[acm_stack_name].stack_outputs.AcmCert }}"
- name: kms alias fact
aws_kms_facts:
filters:
alias: "aws/ssm"
region: "{{ region }}"
register: ssmKeyFacts
- debug:
msg: "{{ ssmKeyFacts }}"
- name: set KMS key from alias
set_fact:
SSMKey: "{{ ssmKeyFacts['keys'][0].key_arn }}"
- name: Generate Lambda file hash
shell: >
md5sum files/instanceSetupLambda.js | awk '{print substr($1, 1, 20)}'
register: hash_output
- set_fact:
instance_setup_source_hash: "{{ hash_output.stdout_lines[0] }}"
- include_vars: vars/CKAN-Stack.var.yml
roles:
- ansible_cloudformation
tasks:
- name: Get stack params
set_fact:
stack_name: "{{ item.name }}"
when: item.template_parameters.Environment == Environment
with_items: "{{ cloudformation_stacks }}"
- name: Get current stack facts
cloudformation_facts:
region: "{{ region }}"
stack_name: "{{ stack_name }}"
stack_resources: true
register: opsworks_facts