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.
ansible/test/integration/targets/rds_instance/tasks/test_read_replica.yml

143 lines
4.2 KiB
YAML

rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
---
- block:
- name: set the two regions for the source DB and the replica
set_fact:
region_src: "{{ aws_region }}"
region_dest: "{{ aws_region }}"
rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
- name: set up aws connection info
set_fact:
aws_connection_info: &aws_connection_info
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
security_token: "{{ security_token }}"
no_log: yes
- name: Ensure the resource doesn't exist
rds_instance:
id: "{{ instance_id }}"
state: absent
skip_final_snapshot: True
region: "{{ region_src }}"
<<: *aws_connection_info
register: result
- assert:
that:
- not result.changed
ignore_errors: yes
- name: Create a source DB instance
rds_instance:
id: "{{ instance_id }}"
state: present
engine: mysql
backup_retention_period: 1
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
region: "{{ region_src }}"
<<: *aws_connection_info
register: source_db
- assert:
that:
- source_db.changed
- "source_db.db_instance_identifier == '{{ instance_id }}'"
- name: Create a read replica in a different region
rds_instance:
id: "{{ instance_id }}-replica"
state: present
source_db_instance_identifier: "{{ instance_id }}"
rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
engine: mysql
username: "{{ username }}"
password: "{{ password }}"
read_replica: True
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
region: "{{ region_dest }}"
<<: *aws_connection_info
register: result
- name: Test idempotence with a read replica
rds_instance:
id: "{{ instance_id }}-replica"
state: present
source_db_instance_identifier: "{{ instance_id }}"
rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
engine: mysql
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
region: "{{ region_dest }}"
<<: *aws_connection_info
register: result
- assert:
that:
- not result.changed
- name: Test idempotence with read_replica=True
rds_instance:
id: "{{ instance_id }}-replica"
state: present
read_replica: True
source_db_instance_identifier: "{{ instance_id }}"
rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
engine: mysql
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
region: "{{ region_dest }}"
<<: *aws_connection_info
register: result
- name: Promote the read replica
rds_instance:
id: "{{ instance_id }}-replica"
state: present
read_replica: False
region: "{{ region_dest }}"
<<: *aws_connection_info
register: result
- assert:
that:
- result.changed
- name: Test idempotence
rds_instance:
id: "{{ instance_id }}-replica"
state: present
read_replica: False
region: "{{ region_dest }}"
<<: *aws_connection_info
register: result
- assert:
that:
- not result.changed
always:
- name: Remove the DB instance
rds_instance:
id: "{{ instance_id }}"
state: absent
skip_final_snapshot: True
region: "{{ region_src }}"
<<: *aws_connection_info
ignore_errors: yes
rds_instance module and tests (#43789) * Add functions to retrieve the allowed and required parameters for boto3 client methods * Add custom waiter for stopping an RDS DB instance * Add rds_instance module * Add rds_instance integration tests * address requested changes from ryansb * address requested changes from willthames * address requested changes from dmsimard * Fix final snapshots Fix idempotence with already-deleting DB instances Remove unused import from module_utils/aws/core.py Consolidate function to get all boto3 client method parameters and the subset of required parameters * Add some additional rds_instance integration tests * Add some common functions to module_utils/aws/rds * Move common code out of rds_instance * Remove hardcoded engine choices and require the minimum boto3 * Document wait behavior * Provide a list of valid engines in the error message if it is invalid Add supported methods to whitelist Remove AWSRetry around waiter Wait for a less crazy amount of time Remove unused variables * Add a test for an invalid engine option * pep8 * Missed adding a method to the whitelist * Use retries * Fix some little things * Fix more things * Improve error message * Support creating cross-region read replicas * Remove unused imports * Add retry when getting RDS instance * Soft-check required options so module fails properly when options are missing * Fix mariadb parameter version * Fix cross-region read_replica creation and tests * fix modify tests * Fix a modification test * Fix typo * Remove test for option_group_name that exists for this account but may not for others and added as a TODO to do properly
6 years ago
- name: Remove the DB replica
rds_instance:
id: "{{ instance_id }}-replica"
state: absent
skip_final_snapshot: True
region: "{{ region_dest }}"
<<: *aws_connection_info
ignore_errors: yes