Note
This plugin is part of the opentelekomcloud.cloud collection (version 0.0.1).
To install it use: ansible-galaxy collection install opentelekomcloud.cloud
.
To use it in a playbook, specify: opentelekomcloud.cloud.floating_ip
.
New in version 0.0.1: of opentelekomcloud.cloud
The below requirements are needed on the host that executes this module.
openstacksdk
openstacksdk >= 0.36.0
otcextensions
python >= 3.6
Note
The standard OpenStack environment variables, such as OS_USERNAME
may be used instead of providing explicit values.
Auth information is driven by openstacksdk, which means that values can come from a yaml config file in /etc/ansible/openstack.yaml, /etc/openstack/clouds.yaml or ~/.config/openstack/clouds.yaml, then from standard environment variables, then finally by explicit parameters in plays. More information can be found at https://docs.openstack.org/openstacksdk/
# Allocate floating IP without attaching it to any resource
- opentelekomcloud.cloud.floating_ip:
cloud: "{{ test_cloud }}"
network: admin_external_net
server: ecs-tino-test
register: fip
# Assign a floating IP to the first interface of `cattle001` from an existing
# external network or nova pool. A new floating IP from the first available
# external network is allocated to the project.
- opentelekomcloud.cloud.floating_ip:
cloud: dguerri
server: cattle001
# Assign a new floating IP to the instance fixed ip `192.0.2.3` of
# `cattle001`. If a free floating IP is already allocated to the project, it is
# reused; if not, a new one is created.
- opentelekomcloud.cloud.floating_ip:
cloud: dguerri
state: present
reuse: yes
server: cattle001
network: ext_net
fixed_address: 192.0.2.3
wait: true
timeout: 180
# Assign a new floating IP from the network `ext_net` to the instance fixed
# ip in network `private_net` of `cattle001`.
- opentelekomcloud.cloud.floating_ip:
cloud: dguerri
state: present
server: cattle001
network: ext_net
nat_destination: private_net
wait: true
timeout: 180
# Detach a floating IP address from a server
- opentelekomcloud.cloud.floating_ip:
cloud: dguerri
state: absent
floating_ip_address: 203.0.113.2
server: cattle001
Common return values are documented here, the following are the fields unique to this module:
OpenStack Ansible SIG, forked and changed by Tino Schreiber (@tischrei)