ecs_ecr
Manage Elastic Container Registry repositories
Collection: community.aws
Full Name: community.aws.ecs_ecr
Synopsis
Manage Elastic Container Registry repositories
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| debug_botocore_endpoint_logs | bool | false | ||
| encryption_configuration | dict | |||
| endpoint_url | str | |||
| force_absent | bool | false | ||
| force_set_policy | bool | false | ||
| image_tag_mutability | str | mutable | ||
| lifecycle_policy | json | |||
| name | str | yes | ||
| policy | json | |||
| profile | str | |||
| purge_lifecycle_policy | bool | |||
| purge_policy | bool | |||
| region | str | |||
| registry_id | str | |||
| scan_on_push | bool | false | ||
| secret_key | str | |||
| session_token | str | |||
| state | str | present | ||
| validate_certs | bool | true |
Example
yaml
# If the repository does not exist, it is created. If it does exist, would not
# affect any policies already on it.
- name: ecr-repo
community.aws.ecs_ecr:
name: super/cool
- name: destroy-ecr-repo
community.aws.ecs_ecr:
name: old/busted
state: absent
- name: Cross account ecr-repo
community.aws.ecs_ecr:
registry_id: 123456789012
name: cross/account
- name: set-policy as object
community.aws.ecs_ecr:
name: needs-policy-object
policy:
Version: '2008-10-17'
Statement:
- Sid: read-only
Effect: Allow
Principal:
AWS: '{{ read_only_arn }}'
Action:
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
- ecr:BatchCheckLayerAvailability
- name: set-policy as string
community.aws.ecs_ecr:
name: needs-policy-string
policy: "{{ lookup('template', 'policy.json.j2') }}"
- name: delete-policy
community.aws.ecs_ecr:
name: needs-no-policy
purge_policy: true
- name: create immutable ecr-repo
community.aws.ecs_ecr:
name: super/cool
image_tag_mutability: immutable
- name: set-lifecycle-policy
community.aws.ecs_ecr:
name: needs-lifecycle-policy
scan_on_push: true
lifecycle_policy:
rules:
- rulePriority: 1
description: new policy
selection:
tagStatus: untagged
countType: sinceImagePushed
countUnit: days
countNumber: 365
action:
type: expire
- name: purge-lifecycle-policy
community.aws.ecs_ecr:
name: needs-no-lifecycle-policy
purge_lifecycle_policy: true
- name: set-encryption-configuration
community.aws.ecs_ecr:
name: uses-custom-kms-key
encryption_configuration:
encryption_type: KMS
kms_key: custom-kms-key-alias