ansible/test/integration/targets/aws_codecommit/tasks/main.yml
Shuang Wang 0c6513e9b1 add module aws_codecommit to represent AWS CodeCommit (#46161)
* kick off

* done for the day

* beta code and test

* fix a typo

* boto3_conn and boto_exception aren't used in this code, ec2_argument_spec is used but unneeded.

* Returning when find a match avoids doing extra work, especially when pagination is involved

* add new permissions for test

* (output is changed) is preferred over accessing the attribute directly.

* pass the result through camel_dict_to_snake_dict() before returning it.

* AnsibleAWSModule automatically merges the argument_spec.

* deletes the created resources even if a test fails.

* AnsibleAWSModule automatically merges the argument_spec.

* fix typo

* fix pep8

* paginate list_repositories

* specify permissions for test

* cut the unnecessary code.

* add return doc string

* add missed ':'

* fix syntax error: mapping values are not allowed here

* add description for return

* fix syntax error

* rename module name and turn off automated integration test.
2018-10-18 14:32:06 +10:00

67 lines
2 KiB
YAML

---
- block:
# ============================================================
- name: set connection information for all tasks
set_fact:
aws_connection_info: &aws_connection_info
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
security_token: "{{ security_token }}"
region: "{{ aws_region }}"
no_log: true
# ============================================================
- name: Create a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
comment: original comment
state: present
<<: *aws_connection_info
register: output
- assert:
that:
- output is changed
- output.repositoryName == '{{ resource_prefix }}_repo'
- output.repositoryDescription == 'original comment'
# ============================================================
- name: Create a repository (CHECK MODE)
aws_codecommit:
name: "{{ resource_prefix }}_check_repo"
comment: original comment
state: present
<<: *aws_connection_info
register: output
check_mode: yes
- assert:
that:
- output is changed
- output.repositoryName == '{{ resource_prefix }}_check_repo'
- output.repositoryDescription == 'original comment'
# ============================================================
- name: Delete a repository (CHECK MODE)
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
<<: *aws_connection_info
register: output
check_mode: yes
- assert:
that:
- output is changed
- name: Delete a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
<<: *aws_connection_info
register: output
- assert:
that:
- output is changed
always:
###### TEARDOWN STARTS HERE ######
- name: Delete a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
<<: *aws_connection_info
ignore_errors: yes