Neu mit optionalem route53 nameservereintrag

This commit is contained in:
Stefan Märkle 2020-12-16 11:42:13 +01:00
parent b44f265407
commit 10fd7b45c8
2 changed files with 20 additions and 0 deletions

View File

@ -20,6 +20,12 @@
prompt: Instance type to request
default: "t4g.nano"
private: no
- name: dns_name
prompt: Which hostname shall be registered for the host (Empty = no dns, Zone needs to be route53 managed)?
default: ""
private: no
vars:
- dns_zone_name: "{{ dns_name | regex_replace('^[\\w-]+\\.', '') }}"
roles:
- aws_graviton_nano_spot

View File

@ -29,8 +29,22 @@
image: "{{ aws_ami }}"
wait: yes
instance_initiated_shutdown_behavior: terminate
vpc_subnet_id: "subnet-3df70f5a"
assign_public_ip: yes
register: graviton
- name: generate route53 dns entry for the instance
route53:
command: create
overwrite: yes
zone: "{{ dns_zone_name }}"
record: "{{ dns_name }}"
type: CNAME
ttl: 60
value: "{{ item.public_dns_name }}"
loop: "{{ graviton.instances }}"
when: dns_name != ""
- name: Wait for SSH to come up
delegate_to: "{{ item.public_dns_name }}"
wait_for_connection: