Jakob Meng 3a08a9c07c Allow to attach multiple floating ips to a server
OpenStack allows to attach multiple floating ips to a single server.
Previously, only one floating ip was supported by this module. It
would call openstacksdk's get_server_public_ip(), which in turn
would return just one of the attached floating ips. If this floating
ip would not point to the right nat_destination or fixed_address,
then the module would fail.

If no floating ip had been attached to a server, then this module
would call openstacksdk's add_ips_to_server() with both parameters
"floating_ip_address" and "network" to attach a floating ip to the
server. But both parameters are mutually exclusive [1], i.e.
add_ips_to_server() will ignore "floating_ip_address" if "network"
is set and then choose any non-attached floating ip from "network".
If "floating_ip_address" has not been created in OpenStack and
"network" is not given, then this module would not create this
floating ip [2].

The new module code allows to create and add more than one floating
ip to a server. It priorizes more specific parameters over generic
ones, i.e. if both "floating_ip_address" and "network" are given,
then "floating_ip_address" precedes "network".

Parameter "network" is now required if "floating_ip_address" is
specified, because both are necessary when creating floating ips.

Module documentation and args have been updated accordingly.

Ref.:
[1] a6b0ece282/openstack/cloud/_floating_ip.py (L987)
[2] a6b0ece282/openstack/cloud/_floating_ip.py (L907)

Task: 40939
Story: 2008181
Change-Id: I1ada1be0994f526f72f81f7458782afbcca3c92c
2021-08-06 15:02:20 +02:00
2021-06-24 23:13:24 +03:00
2020-06-23 21:50:43 +03:00
2021-02-15 20:49:37 +00:00
2021-04-08 00:19:24 +03:00
2019-09-25 15:21:42 +00:00
2021-05-19 14:04:33 -04:00
2021-06-24 23:13:24 +03:00
2020-05-13 08:07:01 -05:00
2020-03-05 15:08:38 +00:00
2021-07-30 09:07:17 +03:00
2021-06-24 16:59:56 +03:00
2020-06-04 14:23:23 +00:00
2021-08-03 01:32:31 +03:00

OpenDev Zuul Builds - Ansible Collection OpenStack

Ansible Collection: openstack.cloud

This repo hosts the openstack.cloud Ansible Collection.

The collection includes the Openstack modules and plugins supported by Openstack community to help the management of Openstack infrastructure.

Installation and Usage

Installing dependencies

For using the Openstack Cloud collection firstly you need to install ansible and openstacksdk Python modules on your Ansible controller. For example with pip:

pip install ansible openstacksdk

OpenStackSDK has to be available to Ansible and to the Python interpreter on the host, where Ansible executes the module (target host). Please note, that under some circumstances Ansible might invoke a non-standard Python interpreter on the target host. Using Python version 3 is highly recommended for OpenstackSDK and strongly required from OpenstackSDK version 0.39.0.


NOTE

OpenstackSDK is better to be the last stable version. It should NOT be installed on Openstack nodes, but rather on operators host (aka "Ansible controller"). OpenstackSDK from last version supports operations on all Openstack cloud versions. Therefore OpenstackSDK module version doesn't have to match Openstack cloud version usually.


Installing the Collection from Ansible Galaxy

Before using the Openstack Cloud collection, you need to install the collection with the ansible-galaxy CLI:

ansible-galaxy collection install openstack.cloud

You can also include it in a requirements.yml file and install it through ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: openstack.cloud

Playbooks

To use a module from the Openstack Cloud collection, please reference the full namespace, collection name, and module name that you want to use:

---
- name: Using Openstack Cloud collection
  hosts: localhost
  tasks:
    - openstack.cloud.server:
        name: vm
        state: present
        cloud: openstack
        region_name: ams01
        image: Ubuntu Server 14.04
        flavor_ram: 4096
        boot_from_volume: True
        volume_size: 75

Or you can add the full namespace and collection name in the collections element:

---
- name: Using Openstack Cloud collection
  hosts: localhost
  collections:
    - openstack.cloud
  tasks:
    - server_volume:
        state: present
        cloud: openstack
        server: Mysql-server
        volume: mysql-data
        device: /dev/vdb

Contributing

For information on contributing, please see CONTRIBUTING

There are many ways in which you can participate in the project, for example:

We work with OpenDev Gerrit, pull requests submitted through GitHub will be ignored.

Testing and Development

If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured COLLECTIONS_PATHS, and work on it there.

Testing with ansible-test

We use ansible-test for sanity:

tox -e linters

More Information

TBD

Communication

We have a dedicated Interest Group for Openstack Ansible modules. You can find other people interested in this in #openstack-ansible-sig on OFTC IRC.

License

GNU General Public License v3.0 or later

See LICENCE to see the full text.

Description
Ansible Modules Collection for using OpenStack
Readme 16 MiB
Languages
Python 99.2%
Shell 0.8%