Adds stateful parameter to security groups
This is a missing option. Change-Id: Ic7b43093d9c35de8962978e9ee108cf7b5379fcd
This commit is contained in:
parent
9b47cb4b59
commit
0aedc268f1
@ -72,4 +72,25 @@
|
||||
name: ansible_security_group
|
||||
state: absent
|
||||
|
||||
- name: Create stateless security group
|
||||
openstack.cloud.security_group:
|
||||
cloud: "{{ cloud }}"
|
||||
name: ansible_security_group_stateless
|
||||
stateful: false
|
||||
state: present
|
||||
description: 'Created from Ansible playbook'
|
||||
register: security_group_stateless
|
||||
|
||||
- name: Assert return values of security_group module
|
||||
assert:
|
||||
that:
|
||||
- security_group_stateless.security_group.name == 'ansible_security_group_stateless'
|
||||
- security_group_stateless.security_group.stateful == False
|
||||
|
||||
- name: Delete stateless security group
|
||||
openstack.cloud.security_group:
|
||||
cloud: "{{ cloud }}"
|
||||
name: ansible_security_group_stateless
|
||||
state: absent
|
||||
|
||||
- include_tasks: rules.yml
|
||||
|
@ -113,6 +113,10 @@ options:
|
||||
choices: [present, absent]
|
||||
default: present
|
||||
type: str
|
||||
stateful:
|
||||
description:
|
||||
- Should the resource be stateful or stateless.
|
||||
type: bool
|
||||
extends_documentation_fragment:
|
||||
- openstack.cloud.openstack
|
||||
'''
|
||||
@ -201,6 +205,14 @@ EXAMPLES = r'''
|
||||
name: foo
|
||||
description: security group for foo servers
|
||||
|
||||
- name: Create a stateless security group
|
||||
openstack.cloud.security_group:
|
||||
cloud: mordred
|
||||
state: present
|
||||
stateful: false
|
||||
name: foo
|
||||
description: stateless security group for foo servers
|
||||
|
||||
- name: Update the existing 'foo' security group description
|
||||
openstack.cloud.security_group:
|
||||
cloud: mordred
|
||||
@ -260,6 +272,7 @@ class SecurityGroupModule(OpenStackModule):
|
||||
),
|
||||
),
|
||||
state=dict(default='present', choices=['absent', 'present']),
|
||||
stateful=dict(type="bool"),
|
||||
)
|
||||
|
||||
module_kwargs = dict(
|
||||
@ -405,7 +418,7 @@ class SecurityGroupModule(OpenStackModule):
|
||||
|
||||
def _create(self):
|
||||
kwargs = dict((k, self.params[k])
|
||||
for k in ['description', 'name']
|
||||
for k in ['description', 'name', 'stateful']
|
||||
if self.params[k] is not None)
|
||||
|
||||
project_name_or_id = self.params['project']
|
||||
|
Loading…
x
Reference in New Issue
Block a user