|
|
@ -26,12 +26,16 @@
|
|
|
|
- Environment:Algo
|
|
|
|
- Environment:Algo
|
|
|
|
register: digital_ocean_droplet
|
|
|
|
register: digital_ocean_droplet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return data is not idempotent
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
|
|
|
droplet: "{{ digital_ocean_droplet.data.droplet | default(digital_ocean_droplet.data) }}"
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- block:
|
|
|
|
- name: "Create a Floating IP"
|
|
|
|
- name: "Create a Floating IP"
|
|
|
|
digital_ocean_floating_ip:
|
|
|
|
digital_ocean_floating_ip:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ algo_do_token }}"
|
|
|
|
oauth_token: "{{ algo_do_token }}"
|
|
|
|
droplet_id: "{{ digital_ocean_droplet.data.droplet.id }}"
|
|
|
|
droplet_id: "{{ droplet.id }}"
|
|
|
|
register: digital_ocean_floating_ip
|
|
|
|
register: digital_ocean_floating_ip
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set the static ip as a fact
|
|
|
|
- name: Set the static ip as a fact
|
|
|
@ -40,7 +44,7 @@
|
|
|
|
when: alternative_ingress_ip
|
|
|
|
when: alternative_ingress_ip
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
- set_fact:
|
|
|
|
cloud_instance_ip: "{{ digital_ocean_droplet.data.droplet.networks.v4.0.ip_address }}"
|
|
|
|
cloud_instance_ip: "{{ (droplet.networks.v4 | selectattr('type', '==', 'public')).0.ip_address }}"
|
|
|
|
ansible_ssh_user: algo
|
|
|
|
ansible_ssh_user: algo
|
|
|
|
ansible_ssh_port: "{{ ssh_port }}"
|
|
|
|
ansible_ssh_port: "{{ ssh_port }}"
|
|
|
|
cloudinit: true
|
|
|
|
cloudinit: true
|
|
|
|