PARALLAX

ecs_ecr

Manage Elastic Container Registry repositories

Collection: community.aws

Full Name: community.aws.ecs_ecr

Synopsis

Manage Elastic Container Registry repositories

Parameters

NameTypeRequiredDefaultDescription
access_keystr
aws_ca_bundlepath
aws_configdict
debug_botocore_endpoint_logsboolfalse
encryption_configurationdict
endpoint_urlstr
force_absentboolfalse
force_set_policyboolfalse
image_tag_mutabilitystrmutable
lifecycle_policyjson
namestryes
policyjson
profilestr
purge_lifecycle_policybool
purge_policybool
regionstr
registry_idstr
scan_on_pushboolfalse
secret_keystr
session_tokenstr
statestrpresent
validate_certsbooltrue

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
Search
    ↑ ↓ move↵ openesc close