Skip to content

Commit

Permalink
[#270] add per enclave bucket policy
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-semenets committed Aug 22, 2018
1 parent 058342c commit 3914c82
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions deploy/ansible/roles/legion_core_chart/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
---

# Create Jenkins IAM role for airflow s3 access
- name: Generate policy documents
- name: Generate trust policy document
template:
src: "{{ item }}.yaml.j2"
dest: "{{ tmp_dir }}/{{ item }}.{{ cluster_name }}.yaml"
with_items:
- trust_policy
- airflow_s3_access_policy
src: "trust_policy.yaml.j2"
dest: "{{ tmp_dir }}/trust_policy.{{ enclave }}.{{ cluster_name }}.yaml"
with_items: "{{ enclaves }}"
loop_control:
loop_var: enclave

- name: Generate airflow s3 access policy document
template:
src: "airflow_s3_access_policy.yaml.j2"
dest: "{{ tmp_dir }}/airflow_s3_access_policy.{{ enclave }}.{{ cluster_name }}.yaml"
with_items: "{{ enclaves }}"
loop_control:
loop_var: enclave

- name: Create Airflow S3 access role
iam:
iam_type: role
name: "{{ cluster_name }}-jenkins-role"
trust_policy_filepath: "{{ tmp_dir }}/trust_policy.{{ cluster_name }}.yaml"
trust_policy_filepath: "{{ tmp_dir }}/trust_policy.{{ enclave }}.{{ cluster_name }}.yaml"
state: present

- name: Attach Airflow S3 accesse policy to the role
iam_policy:
iam_type: role
iam_name: "{{ cluster_name }}-jenkins-role"
policy_name: "{{ cluster_name }}-jenkins-airflow-s3-access-policy"
policy_document: "{{ tmp_dir }}/airflow_s3_access_policy.{{ cluster_name }}.yaml"
policy_document: "{{ tmp_dir }}/airflow_s3_access_policy.{{ enclave }}.{{ cluster_name }}.yaml"
state: present

# Install Legion core chart
Expand Down

0 comments on commit 3914c82

Please sign in to comment.