1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ecs_taskdefinition can absent without containers argument (#41398)

* ecs_taskdefinition can absent without containers argument

* add regression test for absent with arn

* Add PassRole privilege for ecs_cluster to pass
This commit is contained in:
Calvin Wu 2018-07-12 21:16:41 +08:00 committed by Will Thames
parent e4c28571d0
commit 7e42e88cc1
3 changed files with 29 additions and 4 deletions

View file

@ -213,7 +213,8 @@
"arn:aws:iam::{{aws_account}}:role/ansible_lambda_role", "arn:aws:iam::{{aws_account}}:role/ansible_lambda_role",
"arn:aws:iam::{{aws_account}}:role/ecsInstanceRole", "arn:aws:iam::{{aws_account}}:role/ecsInstanceRole",
"arn:aws:iam::{{aws_account}}:role/ecsServiceRole", "arn:aws:iam::{{aws_account}}:role/ecsServiceRole",
"arn:aws:iam::{{aws_account}}:role/aws_eks_cluster_role" "arn:aws:iam::{{aws_account}}:role/aws_eks_cluster_role",
"arn:aws:iam::{{aws_account}}:role/ecsTaskExecutionRole"
] ]
}, },
{ {

View file

@ -325,9 +325,10 @@ def main():
if not module.botocore_at_least('1.10.44'): if not module.botocore_at_least('1.10.44'):
module.fail_json(msg='botocore needs to be version 1.10.44 or higher to use execution_role_arn') module.fail_json(msg='botocore needs to be version 1.10.44 or higher to use execution_role_arn')
for container in module.params.get('containers', []): if module.params['containers']:
for environment in container.get('environment', []): for container in module.params['containers']:
environment['value'] = to_text(environment['value']) for environment in container.get('environment', []):
environment['value'] = to_text(environment['value'])
if module.params['state'] == 'present': if module.params['state'] == 'present':
if 'containers' not in module.params or not module.params['containers']: if 'containers' not in module.params or not module.params['containers']:

View file

@ -654,6 +654,20 @@
# ============================================================ # ============================================================
# End tests for Fargate # End tests for Fargate
- name: create task definition for absent with arn regression test
ecs_taskdefinition:
containers: "{{ ecs_task_containers }}"
family: "{{ ecs_task_name }}-absent"
state: present
<<: *aws_connection_info
register: ecs_task_definition_absent_with_arn
- name: absent task definition by arn
ecs_taskdefinition:
arn: "{{ ecs_task_definition_absent_with_arn.taskdefinition.taskDefinitionArn }}"
state: absent
<<: *aws_connection_info
always: always:
# TEAR DOWN: snapshot, ec2 instance, ec2 key pair, security group, vpc # TEAR DOWN: snapshot, ec2 instance, ec2 key pair, security group, vpc
- name: Announce teardown start - name: Announce teardown start
@ -795,6 +809,15 @@
<<: *aws_connection_info <<: *aws_connection_info
ignore_errors: yes ignore_errors: yes
- name: remove ecs task definition for absent with arn
ecs_taskdefinition:
containers: "{{ ecs_task_containers }}"
family: "{{ ecs_task_name }}-absent"
revision: "{{ ecs_task_definition_absent_with_arn.taskdefinition.revision }}"
state: absent
<<: *aws_connection_info
ignore_errors: yes
- name: remove load balancer - name: remove load balancer
elb_application_lb: elb_application_lb:
name: "{{ ecs_load_balancer_name }}" name: "{{ ecs_load_balancer_name }}"