Skip to content

Commit

Permalink
Openstack add public IP options (#263)
Browse files Browse the repository at this point in the history
* Add options to set auto_ip and floating_ip_pools

* Fix typo in openstack documentation

* Make condition more explicit
  • Loading branch information
vydrazde authored Jan 16, 2025
1 parent a372bd3 commit eab00ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion 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 @@ -139,9 +147,10 @@ Examples
network:
name: molecule # use network from debian10 instance
- name: ubuntu2004
falvor: m1.tiny
flavor: 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 | length > 0 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 eab00ef

Please sign in to comment.