Umstellen auf ansible
This commit is contained in:
parent
64e874f708
commit
e6526cba40
25
gravitoninstance.yml
Normal file
25
gravitoninstance.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# Provisioning of a graviton server using aws spot instance
|
||||||
|
- hosts: local
|
||||||
|
vars_prompt:
|
||||||
|
- name: ssh_pub_key_file
|
||||||
|
prompt: Location of your public ssh key
|
||||||
|
default: "~/.ssh/id_rsa.pub"
|
||||||
|
- name: aws_region
|
||||||
|
prompt: AWS Region to use for instaance
|
||||||
|
default: "us-east-1"
|
||||||
|
- name: aws_ami
|
||||||
|
prompt: Disk image to use for instance (default is ubuntu 20.10 arm64)
|
||||||
|
default: "ami-01069be104eb25898"
|
||||||
|
- name: aws_type
|
||||||
|
prompt: Instance type to request
|
||||||
|
default: "t4g.nano"
|
||||||
|
- name: dns_zone_name
|
||||||
|
prompt: Route53 zone in which nameserver entry is registered
|
||||||
|
default: "appments.net"
|
||||||
|
- name: dns_host_name
|
||||||
|
prompt: Hostname that is registered in Route53
|
||||||
|
default: "illevpn"
|
||||||
|
roles:
|
||||||
|
- aws_graviton_nano_spot
|
||||||
|
- wireguard_server
|
26
roles/aws_graviton_nano_spot/tasks/main.yml
Normal file
26
roles/aws_graviton_nano_spot/tasks/main.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- 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 }}"
|
Loading…
x
Reference in New Issue
Block a user