allow setting a floating ip in config when using digitalocean

This commit is contained in:
Jesse Luehrs 2018-10-16 00:37:20 -04:00
parent cd3fbe5e47
commit 8cf5f5d5a9
2 changed files with 12 additions and 1 deletions

View file

@ -108,9 +108,12 @@ cloud_providers:
azure:
size: Basic_A0
image: 18.04-LTS
# To use floating_ip, first allocate a floating IP via Digital Ocean, and
# then set floating_ip to the IP address that was allocated.
digitalocean:
size: s-1vcpu-1gb
image: "ubuntu-18-04-x64"
floating_ip: false
# Change the encrypted flag to "true" to enable AWS volume encryption, for encryption of data at rest.
# Warning: the Algo script will take approximately 6 minutes longer to complete.
# Also note that the documented AWS minimum permissions aren't sufficient.

View file

@ -60,8 +60,16 @@
ipv6: yes
register: do
- name: "Assigning floating IP..."
digital_ocean_floating_ip:
oauth_token: "{{ algo_do_token }}"
ip: "{{ cloud_providers.digitalocean.floating_ip }}"
droplet_id: "{{ do.droplet.id }}"
when:
- cloud_providers.digitalocean.floating_ip
- set_fact:
cloud_instance_ip: "{{ do.droplet.ip_address }}"
cloud_instance_ip: "{% if cloud_providers.digitalocean.floating_ip %}{{ cloud_providers.digitalocean.floating_ip }}{% else %}{{ do.droplet.ip_address }}{% endif %}"
ansible_ssh_user: root
- name: Tag the droplet