Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - hosts: db
- tasks:
- - name: generate a connection details file from template
- template:
- src: files/db/{{ db_name }}-connection.json.j2
- dest: temp/db/{{ db_name }}-connection.json
- - name: create an S3 bucket
- s3_bucket:
- name: "{{ db_connection_bucket }}"
- aws_access_key: "{{ aws_access_key }}"
- aws_secret_key: "{{ aws_secret_key }}"
- - name: upload the file to S3
- s3:
- bucket: "{{ db_connection_bucket }}"
- mode: put
- src: temp/db/{{ db_name }}connection.json
- object:
- - name: delete our temp file
- file:
- path: temp/db/connection.json
- state: absent
- - hosts: api
- tasks:
- - name: provision an EC2 instance
- ec2:
- group: api
- aws_access_key: "{{ aws_access_key }}"
- aws_secret_key: "{{ aws_secret_key }}"
- instance_type: t2.micro
- image: ami-123456
- instance_tags:
- Name: "{{ api_name }}"
- private_ip: "{{ api_ec2_private_ip }}"
- vpc_subnet_id: subnet-29e63245
- - name: update a Route53 DNS record
- route53:
- state: present
- zone: "{{ api_dns_zone }}"
- record: "{{ api_dns_name }}"
- type: A
- overwrite: true
- ttl: 300
- value: "{{ api_ec2_private_ip }}"
Add Comment
Please, Sign In to add comment