create_rds_secondary.yml 927 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
# Usage: AWS_PROFILE=myprofile ansible-playbook create_csmh_db.yml -i localhost, -e 'from_db=my-rds-identifier rds_name=env-dep-edxapphistory'

- name: Create new edxapp history RDS instance
  hosts: all
  connection: local
  gather_facts: false
  vars:
    from_db: null
    rds_name: null
    region: us-east-1
    instance_type: db.m4.large
    env: null
    app: edxapp

  tasks:
    - name: Validate arguments
      fail:
        msg: "One or more arguments were not set correctly: {{ item }}"
      when: not {{ item }}
      with_items:
        - from_db
        - rds_name

    - name: Create edxapp history RDS instance
      rds:
        command: replicate
        instance_name: "{{ rds_name }}"
        source_instance: "{{ from_db }}"
        region: "{{ region }}"
        instance_type: "{{ instance_type }}"
        publicly_accessible: no
        wait: yes
        wait_timeout: 900
      register: created_db