Skip to content

Ansible modules for RDS Cluster rds_cluster, rds_cluster_info, rds_cluster_instance and rds_cluster_snapshot_facts

License

Notifications You must be signed in to change notification settings

sidneiweber/ansible-modules-rds-cluster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible RDS Cluster Modules

These are drop-in modules for Ansible 2.3+ which provide the following:

  • rds_cluster - can create a new RDS cluster or restore from a cluster snapshot
  • rds_cluster_info - can describe RDS clusters
  • rds_cluster_instance - can create a cluster instance for an existing cluster
  • rds_cluster_snapshot_facts - can search and return details about RDS cluster snapshots

These modules are specifically for working with RDS Clusters.

For regular RDS instances you should look at Ansible's built-in modules.

These are provided in the event they might be of use. I will not be submitting them to the Ansible project for inclusion but you are welcome to do so.

Please read the module sources for usage information. Note that not all functionality is provided but the modules are idempotent as provided.

Example Playbook

---

- name: Restore database snapshot
  hosts: localhost
  connection: local

  tasks:

    - name: Identify latest production cluster automated snapshot
      rds_cluster_snapshot_facts:
        cluster_id: "original-cluster-name"
        snapshot_type: automated
        status: available
        sort: snapshot_create_time
        sort_order: descending
        sort_end: 1
      tags: find-snapshot
      register: snapshot

    - name: Launch cluster from snapshot
      rds_cluster:
        cluster_id: "new-cluster-name"
        snapshot_arn: "{{ snapshot.results[0].db_cluster_snapshot_arn }}"
        state: present
        subnet_group: "my-subnet-group"
        vpc_security_group_ids:
          - "my-security-group"
        wait: yes
      register: cluster
      tags: cluster

    - name: Create DB instance
      rds_cluster_instance:
        apply_immediately: yes
        cluster_id: "{{ cluster.result.DBCluster.DBClusterIdentifier }}"
        instance_id: "{{ cluster.result.DBCluster.DBClusterIdentifier }}-001"
        instance_type: db.t2.small
        monitoring_interval: 60
        monitoring_role_arn: "my-monitoring-arn"
        multi_az: no
        state: present
        subnet_group: "my-subnet-group"
        wait: yes
      register: instance
      tags: instance

About

Ansible modules for RDS Cluster rds_cluster, rds_cluster_info, rds_cluster_instance and rds_cluster_snapshot_facts

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%