2020-12-02 16:04:55 +01:00

27 lines
698 B
YAML

- name: copy ssh public key
amazon.aws.ec2_key:
name: vpn_key
key_material: "{{ lookup('file', '{{ ssh_pub_key_file }}') }}"
- name: create graviton spot instance
amazon.aws.ec2:
spot_type: persistent
spot_wait_timeout: 120
key_name: vpn_key
instance_type: "{{ aws_type }}"
image: "{{ aws_ami }}"
wait: yes
assign_public_ip: yes
instance_initiated_shutdown_behavior: terminate
register: graviton_instance
- name: generate route53 dns entry for the instance
route53:
command: create
overwrite: yes
zone: "{{ dns_zone_name }}"
record: "{{ dns_host_name }}"
type: CNAME
ttl: 60
value: "{{ graviton_instance.domain_name }}"