Amazon RDS

Let's start by creating the file structure for the role by running:

$ ansible-galaxy init roles/rds

Now that's in place, let's discuss what we need to do to launch the RDS instance. To start with, we need to define some default values; add the following to the roles/rds/defaults/main.yml file:

rds:  db_username: "{{ environment_name }}"  db_password: "{{ lookup('password', 'group_vars/rds_passwordfile chars=ascii_letters,digits length=30') }}"  db_name: "{{ environment_name }}"  app_instance_type: "db.t2.micro"  engine: "mariadb"  hdd_size: "5"  no_of_backups: "7"  multi_az: "yes"  wait: "yes"  wait_time: "1200"

Some of the variables are self-explanatory, such as db_username, db_password, and db_name, although, as you can see, we are doing ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.