Skip to content

Commit

Permalink
Add options to set auto_ip and floating_ip_pools
Browse files Browse the repository at this point in the history
  • Loading branch information
vydrazde authored and audgirka committed Jan 3, 2025
1 parent 9514107 commit 2cffcd3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/openstack/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ security_group.rules[].port_min Starting port (can't be used with port)
security_group.rules[].port_max Ending port (can't be used with port)
security_group.rules[].type IPv4 or IPv6, default 'IPv4'
user Default user of image
auto_ip Ensure instance has public IP, mutually \
exclusive with floating_ip_pools, \
default = true
floating_ip_pools List of floating pool IP names to choose a \
floating IP from, mutually exclusive with \
auto_ip, (optional)
volume Mapping of volume settings (optional if \
flavor provides volume)
volume.size Size of volume (GB)
Expand Down Expand Up @@ -96,6 +102,8 @@ Examples
flavor: m1.small
image: Debian_10
user: debian
floating_ip_pools: # mutually exclusive with auto_ip
- 1.2.3.4
network:
name: molecule
router:
Expand Down Expand Up @@ -142,6 +150,7 @@ Examples
falvor: m1.tiny
image: Ubuntu_2004
user: ubuntu
auto_ip: false # do not assign a public IP
security_group:
name: molecule # use security group from debian10 instance
network:
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_plugins/openstack/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class Openstack(Driver):
flavor: m1.small
image: Ubuntu_20.04
user: ubuntu
floating_ip_pools: # mutually exclusive with auto_ip
- 1.2.3.4
security_group:
name: molecule-sec
description: Molecule test
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_plugins/openstack/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
image: "{{ item.image }}"
key_name: "{{ key_name }}"
flavor: "{{ item.flavor }}"
floating_ip_pools: "{{ item.floating_ip_pools if item.floating_ip_pools is defined and item.floating_ip_pools else omit }}"
auto_ip: "{{ item.auto_ip if item.auto_ip is defined else omit }}"
boot_from_volume: "{{ true if item.volume is defined and item.volume.size else false }}"
terminate_volume: "{{ true if item.volume is defined and item.volume.size else false }}"
volume_size: "{{ item.volume.size if item.volume is defined and item.volume.size else omit }}"
Expand Down

0 comments on commit 2cffcd3

Please sign in to comment.