|
14 | 14 | short_description: Manage firewall rules in Proxmox
|
15 | 15 | version_added: "1.4.0"
|
16 | 16 | description:
|
17 |
| - - Create/update/delete firewall rules at cluster/group/vnet/node/vm level. |
18 |
| - - Create/delete firewall security groups. |
| 17 | + - create/update/delete FW rules at cluster/group/vnet/node/vm level |
| 18 | + - Create/delete firewall security groups |
| 19 | + - Create/delete aliases |
19 | 20 | author: 'Jana Hoch <[email protected]> (!UNKNOWN)'
|
20 | 21 | attributes:
|
21 | 22 | check_mode:
|
|
25 | 26 | options:
|
26 | 27 | state:
|
27 | 28 | description:
|
28 |
| - - Create/update/delete firewall rules or security group. |
| 29 | + - Create/update/delete firewall rules or security group. |
29 | 30 | type: str
|
30 | 31 | choices:
|
31 | 32 | - present
|
32 | 33 | - absent
|
33 | 34 | default: present
|
34 | 35 | update:
|
35 | 36 | description:
|
36 |
| - - If O(state=present) and if one or more rule/alias already exists it will update them. |
| 37 | + - If O(state=present) and if one or more rule/alias already exists it will update them. |
37 | 38 | type: bool
|
38 | 39 | default: true
|
39 | 40 | level:
|
@@ -427,7 +428,8 @@ def validate_params(self):
|
427 | 428 | msg="When state is present either group_conf should be true or rules/aliases must be present but not both"
|
428 | 429 | )
|
429 | 430 | elif self.params.get('state') == 'absent':
|
430 |
| - if self.params.get('group_conf') != bool(self.params.get('pos') or self.params.get('aliases')): |
| 431 | + if self.params.get('group_conf') != bool( |
| 432 | + (self.params.get('pos') is not None) or self.params.get('aliases')): |
431 | 433 | return True
|
432 | 434 | else:
|
433 | 435 | self.module.fail_json(
|
@@ -482,7 +484,7 @@ def run(self):
|
482 | 484 | if aliases:
|
483 | 485 | self.aliases_present(firewall_obj=firewall_obj, level=level, aliases=aliases, update=update)
|
484 | 486 | elif state == "absent":
|
485 |
| - if self.params.get('pos'): |
| 487 | + if self.params.get('pos') is not None: |
486 | 488 | self.fw_rule_absent(rules_obj=rules_obj, pos=self.params.get('pos'))
|
487 | 489 | if group_conf:
|
488 | 490 | self.group_absent(group_name=group)
|
|
0 commit comments