|
8 | 8 |
|
9 | 9 | - name: Setting previous command output into variable.
|
10 | 10 | ansible.builtin.set_fact:
|
11 |
| - _acc_id: "{{ _acc_id.stdout | from_json }}" |
| 11 | + _acc_id: "{{ _acc_id.stdout }}" |
12 | 12 |
|
13 | 13 | - name: Create a role and attach policies for events.
|
14 | 14 | ansible.builtin.include_role:
|
15 | 15 | name: aws/aws_iam_role
|
16 | 16 | vars:
|
17 | 17 | aws_iam_role:
|
18 | 18 | name: "{{ item.name }}_event"
|
19 |
| - source: "{{ item.name}}" |
| 19 | + source: "{{ item.name }}" |
20 | 20 | aws_profile: "{{ _aws_profile }}"
|
21 | 21 | inline_policies:
|
22 | 22 | name: "{{ item.name }}_event"
|
|
25 | 25 | - "lambda:InvokeFunction"
|
26 | 26 | policy_document: "{{ lookup('template', 'event_document_policy.json.j2') }}"
|
27 | 27 | loop: "{{ aws_backup_validation.resources }}"
|
28 |
| - loop_control: |
29 |
| - extended: true |
30 |
| - extended_allitems: false |
31 | 28 |
|
32 | 29 | - name: Create a role and attach policies for Lambda functions.
|
33 | 30 | ansible.builtin.include_role:
|
34 | 31 | name: aws/aws_iam_role
|
35 | 32 | vars:
|
36 | 33 | aws_iam_role:
|
37 | 34 | name: "{{ item.name}}_lambda"
|
38 |
| - source: "{{ item.name}}" |
| 35 | + source: "{{ item.name }}" |
39 | 36 | aws_profile: "{{ _aws_profile }}"
|
40 | 37 | managed_policies:
|
41 | 38 | - arn:aws:iam::aws:policy/CloudWatchLogsFullAccess
|
|
45 | 42 | action: "{{ item.lambda_policy }}"
|
46 | 43 | policy_document: "{{ lookup('template', 'trusted_entitites.json.j2') }}"
|
47 | 44 | loop: "{{ aws_backup_validation.resources }}"
|
48 |
| - loop_control: |
49 |
| - extended: true |
50 |
| - extended_allitems: false |
| 45 | + |
| 46 | +- name: Wait for 6 seconds for IAM to be ready. |
| 47 | + ansible.builtin.wait_for: |
| 48 | + timeout: 6 |
51 | 49 |
|
52 | 50 | - name: Get info about newly created restore testing plan.
|
53 | 51 | ansible.builtin.command: >
|
|
70 | 68 | tags:
|
71 | 69 | Name: "{{ item.name }}"
|
72 | 70 | loop: "{{ aws_backup_validation.resources }}"
|
73 |
| - when: item.git_url is not defined |
| 71 | + when: item.git is not defined |
74 | 72 |
|
75 | 73 | - name: Create Lambda functions from git url.
|
76 | 74 | ansible.builtin.include_role:
|
|
88 | 86 | tags:
|
89 | 87 | Name: "{{ item.name }}"
|
90 | 88 | loop: "{{ aws_backup_validation.resources }}"
|
91 |
| - when: item.git_url is defined |
| 89 | + when: item.git is defined and item.git |
92 | 90 |
|
93 | 91 | - name: Create an IAM Managed Policy for passing roles and setup IAM role.
|
94 | 92 | ansible.builtin.include_role:
|
|
107 | 105 | - arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup
|
108 | 106 | - arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForRestores
|
109 | 107 |
|
| 108 | +- name: Wait for 6 seconds for IAM to be ready. |
| 109 | + ansible.builtin.wait_for: |
| 110 | + timeout: 6 |
| 111 | + |
110 | 112 | # TODO: Not all clients have verified identity
|
111 | 113 | #- name: Get verified domain.
|
112 | 114 | # ansible.builtin.include_tasks: get_valid_email.yml
|
|
0 commit comments