diff --git a/ansible/README b/ansible/README index f5604b9..ceffcc3 100644 --- a/ansible/README +++ b/ansible/README @@ -1,3 +1,14 @@ Dependencies: - awscli - python3-boto3 + + +Before running any of the EC2 related playbooks, first create a vars file. Use host_vars/datanommer.yml as a reference. +When running the playbook add an extra var "-e initiative_name=" + +i.e. ansible-playbook create_ec2.yml -e "initiative_name=datanommer" + +When creating a snapshot a description must be passed as an extra var with the key `snap_description` +The description should mention why the snaphot was created. + +i.e. ansible-playbook snapshot_ebs_volume.yml -e "initiative_name=datanommer" -e "snap_description=database partitioned by year" diff --git a/ansible/create_ec2.yml b/ansible/create_ec2.yml index 2664835..fbf37bb 100644 --- a/ansible/create_ec2.yml +++ b/ansible/create_ec2.yml @@ -9,6 +9,9 @@ roles: - ec2_instance + post_tasks: + - meta: refresh_inventory + - name: Put ssh keys on host hosts: "{{initiative_name}}" @@ -24,4 +27,5 @@ - pingou - mobrien - wwoods + - asaleh diff --git a/ansible/inventory b/ansible/inventory index 50f37a1..5737c91 100644 --- a/ansible/inventory +++ b/ansible/inventory @@ -1,3 +1,6 @@ [datanommer] datanommer ansible_host=100.26.18.234 +[datanommer-test] datanommer-test ansible_host=54.236.16.215 +[datanommer-timescale] +datanommer-timescale ansible_host=54.146.95.101 diff --git a/ansible/roles/snapshot_ebs_volume/tasks/main.yml b/ansible/roles/snapshot_ebs_volume/tasks/main.yml index 5322ad7..49cdc1e 100644 --- a/ansible/roles/snapshot_ebs_volume/tasks/main.yml +++ b/ansible/roles/snapshot_ebs_volume/tasks/main.yml @@ -15,6 +15,6 @@ - name: create snapshot ec2_snapshot: volume_id: "{{instance_info.instances[0].block_device_mappings[0].ebs.volume_id}}" - description: "Snapshot of volume for the {{instance_name}} ec2 instance" + description: "{{ snap_description }}" region: "{{ aws_region }}" wait: no