mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
222 lines
6.5 KiB
YAML
222 lines
6.5 KiB
YAML
---
|
|
# XXX rds_subnet_group doesn't support check_mode yet
|
|
|
|
# ============================================================
|
|
# Basic creation
|
|
- name: 'Create a subnet group'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Create a subnet group (idempotency)'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
|
|
# ============================================================
|
|
# Update description
|
|
|
|
- name: 'Update subnet group description'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description_changed }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.subnet_group.description == group_description_changed
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Update subnet group description (idempotency)'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description_changed }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.subnet_group.description == group_description_changed
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Restore subnet group description'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
|
|
# ============================================================
|
|
# Update subnets
|
|
|
|
- name: 'Update subnet group list'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[2] }}'
|
|
- '{{ subnet_ids[3] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[2] in result.subnet_group.subnet_ids
|
|
- subnet_ids[3] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Update subnet group list (idempotency)'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[2] }}'
|
|
- '{{ subnet_ids[3] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 2
|
|
- subnet_ids[2] in result.subnet_group.subnet_ids
|
|
- subnet_ids[3] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Add more subnets subnet group list'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
- '{{ subnet_ids[2] }}'
|
|
- '{{ subnet_ids[3] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 4
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
- subnet_ids[2] in result.subnet_group.subnet_ids
|
|
- subnet_ids[3] in result.subnet_group.subnet_ids
|
|
|
|
- name: 'Add more members to subnet group list (idempotency)'
|
|
rds_subnet_group:
|
|
state: present
|
|
name: '{{ resource_prefix }}'
|
|
description: '{{ group_description }}'
|
|
subnets:
|
|
- '{{ subnet_ids[0] }}'
|
|
- '{{ subnet_ids[1] }}'
|
|
- '{{ subnet_ids[2] }}'
|
|
- '{{ subnet_ids[3] }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
- result.subnet_group.description == group_description
|
|
- result.subnet_group.name == resource_prefix
|
|
- result.subnet_group.vpc_id == vpc.vpc.id
|
|
- result.subnet_group.subnet_ids | length == 4
|
|
- subnet_ids[0] in result.subnet_group.subnet_ids
|
|
- subnet_ids[1] in result.subnet_group.subnet_ids
|
|
- subnet_ids[2] in result.subnet_group.subnet_ids
|
|
- subnet_ids[3] in result.subnet_group.subnet_ids
|
|
|
|
# ============================================================
|
|
# Deletion
|
|
|
|
- name: 'Delete a subnet group'
|
|
rds_subnet_group:
|
|
state: absent
|
|
name: '{{ resource_prefix }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: 'Delete a subnet group (idempotency)'
|
|
rds_subnet_group:
|
|
state: absent
|
|
name: '{{ resource_prefix }}'
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|