|
23 | 23 | - aws_rds.db_parameters is defined
|
24 | 24 | - aws_rds.db_parameters | length > 0
|
25 | 25 |
|
| 26 | +- name: Generate security group information. |
| 27 | + ansible.builtin.include_role: |
| 28 | + name: aws/aws_security_groups |
| 29 | + vars: |
| 30 | + aws_security_groups: |
| 31 | + profile: "{{ aws_rds.aws_profile }}" |
| 32 | + region: "{{ aws_rds.region }}" |
| 33 | + group_names: "{{ aws_rds.security_groups }}" |
| 34 | + return_type: ids |
| 35 | + when: aws_rds.security_groups | length > 0 |
| 36 | + |
| 37 | +- name: Create Aurora cluster. |
| 38 | + amazon.aws.rds_cluster: |
| 39 | + profile: "{{ aws_rds.aws_profile }}" |
| 40 | + region: "{{ aws_rds.region }}" |
| 41 | + cluster_id: "{{ aws_rds.name }}" |
| 42 | + engine: "{{ aws_rds.engine }}" |
| 43 | + engine_version: "{{ aws_rds.engine_version }}" |
| 44 | + username: "{{ aws_rds.master_username }}" |
| 45 | + password: "{{ aws_rds.master_user_password }}" |
| 46 | + db_subnet_group_name: "{{ aws_rds.name }}" |
| 47 | + vpc_security_group_ids: "{{ _aws_security_group_list }}" |
| 48 | + backup_retention_period: "{{ aws_rds.backup_retention_period | default(35) }}" |
| 49 | + character_set_name: "{{ aws_rds.character_set_name | default(omit) }}" |
| 50 | + tags: "{{ aws_rds.tags | combine({'Name': aws_rds.name}) }}" |
| 51 | + when: "'aurora' in aws_rds.engine" |
| 52 | + |
26 | 53 | - name: Create Aurora RDS instance.
|
27 | 54 | amazon.aws.rds_instance:
|
28 | 55 | db_instance_identifier: "{{ aws_rds.name }}-{{ aws_rds.aurora_suffix }}"
|
29 | 56 | db_instance_class: "{{ aws_rds.db_instance_class }}"
|
30 | 57 | db_cluster_identifier: "{{ aws_rds.db_cluster_identifier | default(aws_rds.name) }}"
|
31 | 58 | db_parameter_group_name: "{{ aws_rds.db_parameter_group_name | default(omit) }}"
|
| 59 | + db_subnet_group_name: "{{ aws_rds.name }}" |
32 | 60 | state: "{{ aws_rds.state }}"
|
33 | 61 | engine: "{{ aws_rds.engine }}"
|
34 | 62 | copy_tags_to_snapshot: true
|
|
49 | 77 | db_cluster_identifier: "{{ aws_rds.db_cluster_identifier | default(aws_rds.name) }}"
|
50 | 78 | db_instance_class: "{{ aws_rds.db_instance_class }}"
|
51 | 79 | db_parameter_group_name: "{{ aws_rds.db_parameter_group_name | default(omit) }}"
|
| 80 | + db_subnet_group_name: "{{ aws_rds.name }}" |
52 | 81 | state: "{{ aws_rds.state }}"
|
53 | 82 | engine: "{{ aws_rds.engine }}"
|
54 | 83 | copy_tags_to_snapshot: true
|
|
64 | 93 | - "'aurora' in aws_rds.engine"
|
65 | 94 | - aws_rds.aurora_reader
|
66 | 95 |
|
67 |
| -- name: Generate security group information. |
68 |
| - ansible.builtin.include_role: |
69 |
| - name: aws/aws_security_groups |
70 |
| - vars: |
71 |
| - aws_security_groups: |
72 |
| - profile: "{{ aws_rds.aws_profile }}" |
73 |
| - region: "{{ aws_rds.region }}" |
74 |
| - group_names: "{{ aws_rds.security_groups }}" |
75 |
| - return_type: ids |
76 |
| - when: aws_rds.security_groups | length > 0 |
77 |
| - |
78 | 96 | - name: Create RDS instance.
|
79 | 97 | amazon.aws.rds_instance:
|
80 | 98 | profile: "{{ aws_rds.aws_profile }}"
|
|
214 | 232 | when:
|
215 | 233 | - aws_rds.backup is defined
|
216 | 234 | - aws_rds.backup | length > 0
|
| 235 | + - "'aurora' not in aws_rds.engine" |
0 commit comments