-
Notifications
You must be signed in to change notification settings - Fork 25
Add Maestro modules and modify checkpoint.py to support special maestro modules #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Ansible module to manage CheckPoint Firewall (c) 2019 | ||
# | ||
# Ansible is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Ansible is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
|
||
__metaclass__ = type | ||
|
||
DOCUMENTATION = ''' | ||
--- | ||
author: Roi Tal (@chkp-roital) | ||
description: Handle pending changes, either apply or delete them. | ||
module: cp_gaia_maestro_changes | ||
short_description: Handle pending changes, either apply or delete them. | ||
version_added: '3.0.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update version |
||
requirements: ['supported starting from gaia_api >= 1.8'] | ||
options: | ||
version: | ||
description: Gaia API version for example 1.6. | ||
required: False | ||
type: str | ||
state: | ||
description: Ansible state which can be C(present) or C(absent). absent will delete the pending changes, present will apply them | ||
required: False | ||
type: str | ||
default: present | ||
choices: [present, absent] | ||
notes: | ||
- Supports C(check_mode). | ||
''' | ||
|
||
EXAMPLES = """ | ||
- name: Delete pending changes | ||
check_point.gaia.cp_gaia_user: | ||
state: absent | ||
|
||
""" | ||
|
||
RETURN = """ | ||
|
||
""" | ||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ansible_collections.check_point.gaia.plugins.module_utils.checkpoint import chkp_api_call, checkpoint_argument_spec_for_all | ||
|
||
|
||
def main(): | ||
# arguments for the module: | ||
fields = dict( | ||
state=dict(type='str', default='present', choices=['present', 'absent']) | ||
) | ||
fields.update(checkpoint_argument_spec_for_all) | ||
module = AnsibleModule(argument_spec=fields, supports_check_mode=True) | ||
api_call_object = "maestro-security-groups-changes" | ||
|
||
res = chkp_api_call(module, api_call_object, False, is_maestro_special=True) | ||
module.exit_json(**res) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Ansible module to manage CheckPoint Firewall (c) 2019 | ||
# | ||
# Ansible is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Ansible is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
|
||
__metaclass__ = type | ||
|
||
DOCUMENTATION = ''' | ||
--- | ||
author: Roi Tal (@chkp-roital) | ||
description: Assign, re-assign or un-assign Gateways to Security Groups, and change GW descriptions. | ||
module: cp_gaia_maestro_gateways | ||
short_description: Modify Security Group Members. | ||
version_added: '3.0.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update version here and in all other files |
||
requirements: ['supported starting from gaia_api >= 1.8'] | ||
options: | ||
version: | ||
description: Gaia API version for example 1.6. | ||
required: False | ||
type: str | ||
id: | ||
description: The serial of the Gateway you wish to modify | ||
required: True | ||
type: str | ||
security_group: | ||
description: Choose ID of Security Group to assign this Gateway to | ||
required: False | ||
type: int | ||
description: | ||
description: Description of this Gateway | ||
required: False | ||
type: str | ||
|
||
notes: | ||
- Supports C(check_mode). | ||
''' | ||
|
||
EXAMPLES = """ | ||
- name: Assign GW to SG and add description | ||
check_point.gaia.cp_gaia_gateways: | ||
id: 1007RT1992 | ||
security_group: 1 | ||
description: "1007RT1992 GW Description" | ||
|
||
""" | ||
|
||
RETURN = """ | ||
maestro_gateway: | ||
description: The updated Maestro Gateway details. | ||
returned: always. | ||
type: dict | ||
""" | ||
|
||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ansible_collections.check_point.gaia.plugins.module_utils.checkpoint import chkp_api_call, checkpoint_argument_spec_for_all | ||
|
||
def main(): | ||
# arguments for the module: | ||
fields = dict( | ||
id=dict(type='str', required=True), | ||
security_group=dict(type="int"), | ||
description=dict(type="str") | ||
) | ||
fields.update(checkpoint_argument_spec_for_all) | ||
module = AnsibleModule(argument_spec=fields, supports_check_mode=True) | ||
api_call_object = 'maestro-gateway' | ||
show_params = ["id"] | ||
res = chkp_api_call(module, api_call_object, False, show_params=show_params) | ||
module.exit_json(**res) | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make it 7.0.0 as someone else is releasing 6.0.0
and pay attention to version added in other files
update all the same