Skip to content

Commit 81df358

Browse files
authored
adds for_system_vms to cs_vlan_ip_range (#18)
closes #15
1 parent 5da55df commit 81df358

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

plugins/modules/cs_vlan_ip_range.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@
105105
VLAN range to the Physical Network with a Public traffic type.
106106
type: bool
107107
default: no
108+
for_system_vms:
109+
description:
110+
- C(yes) if IP range is set to system vms, C(no) if not
111+
type: bool
112+
default: no
108113
extends_documentation_fragment:
109114
- ngine_io.cloudstack.cloudstack
110115
'''
@@ -306,6 +311,7 @@ def create_vlan_ip_range(self):
306311
'vlan': self.get_network(key='vlan') if not vlan else vlan,
307312
'networkid': self.get_network(key='id'),
308313
'forvirtualnetwork': self.module.params.get('for_virtual_network'),
314+
'forsystemvms': self.module.params.get('for_system_vms'),
309315
}
310316
if self.module.params.get('physical_network'):
311317
args['physicalnetworkid'] = self.get_physical_network(key='id')
@@ -353,6 +359,7 @@ def main():
353359
account=dict(type='str'),
354360
project=dict(type='str'),
355361
for_virtual_network=dict(type='bool', default=False),
362+
for_system_vms=dict(type='bool', default=False),
356363
))
357364

358365
module = AnsibleModule(

tests/integration/targets/cs_vlan_ip_range/tasks/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,32 @@
422422
- public_range.zone == cszone.name
423423
- public_range.start_ip == '10.0.3.10'
424424
- public_range.end_ip == '10.0.3.250'
425+
- public_range.for_systemvms == false
426+
427+
- name: test adding a public IP range for System VMs
428+
cs_vlan_ip_range:
429+
end_ip: 10.0.4.250
430+
start_ip: 10.0.4.10
431+
zone: "{{ cszone.name }}"
432+
netmask: 255.255.255.0
433+
for_virtual_network: 'yes'
434+
for_system_vms: 'yes'
435+
gateway: 10.0.4.2
436+
vlan: untagged
437+
register: public_range
438+
- name: verify test adding a public IP range for System VMs
439+
assert:
440+
that:
441+
- public_range is successful
442+
- public_range is changed
443+
- public_range.physical_network == public_network.id
444+
- public_range.vlan == 'vlan://untagged'
445+
- public_range.gateway == '10.0.4.2'
446+
- public_range.netmask == '255.255.255.0'
447+
- public_range.zone == cszone.name
448+
- public_range.start_ip == '10.0.4.10'
449+
- public_range.end_ip == '10.0.4.250'
450+
- public_range.for_systemvms == true
425451

426452
- name: cleanup the network
427453
cs_physical_network:

0 commit comments

Comments
 (0)