2018-10-18 06:32:06 +02:00
|
|
|
---
|
2019-08-30 20:25:37 +02:00
|
|
|
- module_defaults:
|
|
|
|
group/aws:
|
|
|
|
aws_access_key: "{{ aws_access_key }}"
|
|
|
|
aws_secret_key: "{{ aws_secret_key }}"
|
|
|
|
security_token: "{{ security_token | default(omit) }}"
|
|
|
|
region: "{{ aws_region }}"
|
|
|
|
block:
|
2018-10-18 06:32:06 +02:00
|
|
|
# ============================================================
|
2019-08-30 20:25:37 +02:00
|
|
|
- name: Create a repository (CHECK MODE)
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
description: original comment
|
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
check_mode: yes
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
|
|
|
|
2018-10-18 06:32:06 +02:00
|
|
|
- name: Create a repository
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
2019-08-30 20:25:37 +02:00
|
|
|
description: original comment
|
2018-10-18 06:32:06 +02:00
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
2019-08-30 20:25:37 +02:00
|
|
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
|
|
|
- output.repository_metadata.repository_description == 'original comment'
|
|
|
|
|
|
|
|
- name: No-op update to repository
|
2018-10-18 06:32:06 +02:00
|
|
|
aws_codecommit:
|
2019-08-30 20:25:37 +02:00
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
description: original comment
|
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is not changed
|
|
|
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
|
|
|
- output.repository_metadata.repository_description == 'original comment'
|
|
|
|
|
|
|
|
- name: Update repository description (CHECK MODE)
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
description: new comment
|
2018-10-18 06:32:06 +02:00
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
check_mode: yes
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
2019-08-30 20:25:37 +02:00
|
|
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
|
|
|
- output.repository_metadata.repository_description == 'original comment'
|
|
|
|
|
|
|
|
- name: Update repository description
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
description: new comment
|
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
|
|
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
|
|
|
- output.repository_metadata.repository_description == 'new comment'
|
|
|
|
|
2018-10-18 06:32:06 +02:00
|
|
|
# ============================================================
|
|
|
|
- name: Delete a repository (CHECK MODE)
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
check_mode: yes
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
2019-08-30 20:25:37 +02:00
|
|
|
|
2018-10-18 06:32:06 +02:00
|
|
|
- name: Delete a repository
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is changed
|
|
|
|
|
2019-08-30 20:25:37 +02:00
|
|
|
- name: Delete a non-existent repository
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output is not changed
|
|
|
|
|
2018-10-18 06:32:06 +02:00
|
|
|
always:
|
|
|
|
###### TEARDOWN STARTS HERE ######
|
|
|
|
- name: Delete a repository
|
|
|
|
aws_codecommit:
|
|
|
|
name: "{{ resource_prefix }}_repo"
|
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|