diff options
Diffstat (limited to 'ansible_collections/kaytus/ksmanage/plugins')
130 files changed, 15780 insertions, 15780 deletions
diff --git a/ansible_collections/kaytus/ksmanage/plugins/doc_fragments/ksmanage.py b/ansible_collections/kaytus/ksmanage/plugins/doc_fragments/ksmanage.py index d81584675..05faebd2e 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/doc_fragments/ksmanage.py +++ b/ansible_collections/kaytus/ksmanage/plugins/doc_fragments/ksmanage.py @@ -1,59 +1,59 @@ -# -*- coding:utf-8 -*-
-
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-
-class ModuleDocFragment(object):
-
- # Standard files documentation fragment
- DOCUMENTATION = r'''
-options:
- provider:
- description:
- - A dict object containing connection details.
- type: dict
- suboptions:
- host:
- description:
- - Specifies the DNS host name or address for connecting to the remote
- device over the specified transport. The value of host is used as
- the destination address for the transport.
- type: str
- username:
- description:
- - Configures the username to use to authenticate the connection to
- the remote device. If the value is not specified in the task, the value of environment
- variable C(ANSIBLE_NET_USERNAME) will be used instead.
- type: str
- password:
- description:
- - Specifies the password to use to authenticate the connection to
- the remote device. If the value is not specified in the task, the
- value of environment variable C(ANSIBLE_NET_PASSWORD) will be used instead.
- type: str
- host:
- description:
- - Specifies the DNS host name or address for connecting to the remote
- device over the specified transport. The value of host is used as
- the destination address for the transport.
- type: str
- username:
- description:
- - Configures the username to use to authenticate the connection to
- the remote device. If the value is not specified in the task, the value of environment
- variable C(ANSIBLE_NET_USERNAME) will be used instead.
- type: str
- password:
- description:
- - Specifies the password to use to authenticate the connection to
- the remote device. If the value is not specified in the task, the
- value of environment variable C(ANSIBLE_NET_PASSWORD) will be used instead.
- type: str
-requirements:
- - Python 3.7+
- - inManage
-'''
+# -*- coding:utf-8 -*- + +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + + +class ModuleDocFragment(object): + + # Standard files documentation fragment + DOCUMENTATION = r''' +options: + provider: + description: + - A dict object containing connection details. + type: dict + suboptions: + host: + description: + - Specifies the DNS host name or address for connecting to the remote + device over the specified transport. The value of host is used as + the destination address for the transport. + type: str + username: + description: + - Configures the username to use to authenticate the connection to + the remote device. If the value is not specified in the task, the value of environment + variable C(ANSIBLE_NET_USERNAME) will be used instead. + type: str + password: + description: + - Specifies the password to use to authenticate the connection to + the remote device. If the value is not specified in the task, the + value of environment variable C(ANSIBLE_NET_PASSWORD) will be used instead. + type: str + host: + description: + - Specifies the DNS host name or address for connecting to the remote + device over the specified transport. The value of host is used as + the destination address for the transport. + type: str + username: + description: + - Configures the username to use to authenticate the connection to + the remote device. If the value is not specified in the task, the value of environment + variable C(ANSIBLE_NET_USERNAME) will be used instead. + type: str + password: + description: + - Specifies the password to use to authenticate the connection to + the remote device. If the value is not specified in the task, the + value of environment variable C(ANSIBLE_NET_PASSWORD) will be used instead. + type: str +requirements: + - Python 3.7+ + - inManage +''' diff --git a/ansible_collections/kaytus/ksmanage/plugins/module_utils/ksmanage.py b/ansible_collections/kaytus/ksmanage/plugins/module_utils/ksmanage.py index 40cf48526..1152f7710 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/module_utils/ksmanage.py +++ b/ansible_collections/kaytus/ksmanage/plugins/module_utils/ksmanage.py @@ -1,54 +1,54 @@ -# -*- coding:utf-8 -*-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-try:
- import inmanage
- ksmanage_temp = True
-except ImportError:
- ksmanage_temp = False
-from ansible.module_utils.basic import env_fallback
-from ansible.module_utils.six import iteritems
-
-ksmanage_provider_spec = {
- 'host': dict(type='str'),
- 'username': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])),
- 'password': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True),
-}
-ksmanage_argument_spec = {
- 'provider': dict(type='dict', options=ksmanage_provider_spec),
-}
-ksmanage_top_spec = {
- 'host': dict(type='str'),
- 'username': dict(type='str'),
- 'password': dict(type='str', no_log=True),
-}
-ksmanage_argument_spec.update(ksmanage_top_spec)
-
-
-def load_params(module):
- """load_params"""
- provider = module.params.get('provider') or dict()
- for key, value in iteritems(provider):
- if key in ksmanage_argument_spec:
- if module.params.get(key) is None and value is not None:
- module.params[key] = value
-
-
-def get_connection(module):
- """get_connection"""
- load_params(module)
- # result = dict()
- # if module.check_mode:
- # result['changed'] = True
- # result['state'] = 'Success'
- # result['message'] = module.params['subcommand']
- # else:
- dict_param = module.params
- if not ksmanage_temp:
- module.fail_json(msg='inManage must be installed to use this module')
- result = inmanage.main(dict_param)
- return result
+# -*- coding:utf-8 -*- +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +try: + import inmanage + ksmanage_temp = True +except ImportError: + ksmanage_temp = False +from ansible.module_utils.basic import env_fallback +from ansible.module_utils.six import iteritems + +ksmanage_provider_spec = { + 'host': dict(type='str'), + 'username': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])), + 'password': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True), +} +ksmanage_argument_spec = { + 'provider': dict(type='dict', options=ksmanage_provider_spec), +} +ksmanage_top_spec = { + 'host': dict(type='str'), + 'username': dict(type='str'), + 'password': dict(type='str', no_log=True), +} +ksmanage_argument_spec.update(ksmanage_top_spec) + + +def load_params(module): + """load_params""" + provider = module.params.get('provider') or dict() + for key, value in iteritems(provider): + if key in ksmanage_argument_spec: + if module.params.get(key) is None and value is not None: + module.params[key] = value + + +def get_connection(module): + """get_connection""" + load_params(module) + # result = dict() + # if module.check_mode: + # result['changed'] = True + # result['state'] = 'Success' + # result['message'] = module.params['subcommand'] + # else: + dict_param = module.params + if not ksmanage_temp: + module.fail_json(msg='inManage must be installed to use this module') + result = inmanage.main(dict_param) + return result diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group.py index f7c408922..055f1ec75 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group.py @@ -1,158 +1,158 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ad_group
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Manage active directory group information
-description:
- - Manage active directory group information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- state:
- description:
- - Whether the active directory group should exist or not, taking action if the state is different from what is stated.
- choices: ['present', 'absent']
- default: present
- type: str
- name:
- description:
- - Enter the Role Group Name. This name identifies the role group in Active Directory.
- type: str
- required: true
- domain:
- description:
- - Enter the Role Group Domain. This is the domain where the role group is located.
- type: str
- pri:
- description:
- - Enter the Role Group Privilege. This is the level of privilege to be assigned for this role group.
- choices: ['administrator', 'user', 'operator', 'oem', 'none']
- type: str
- kvm:
- description:
- - This field provides access to KVM for AD authenticated role group user.
- choices: ['enable', 'disable']
- type: str
- vm:
- description:
- - This field provides access to VMedia for AD authenticated role group user.
- choices: ['enable', 'disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ad group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Add active directory group information"
- kaytus.ksmanage.ad_group:
- state: "present"
- name: "wbs"
- domain: "test.com"
- pri: "administrator"
- kvm: "enable"
- vm: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set active directory group information"
- kaytus.ksmanage.ad_group:
- state: "present"
- name: "wbs"
- pri: "user"
- kvm: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Delete active directory group information"
- kaytus.ksmanage.ad_group:
- state: "absent"
- name: "wbs"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AD(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'editadgroup'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- state=dict(type='str', choices=['present', 'absent'], default='present'),
- name=dict(type='str', required=True),
- domain=dict(type='str', required=False),
- pri=dict(type='str', required=False, choices=['administrator', 'user', 'operator', 'oem', 'none']),
- kvm=dict(type='str', required=False, choices=['enable', 'disable']),
- vm=dict(type='str', required=False, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- ad_obj = AD(argument_spec)
- ad_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ad_group +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Manage active directory group information +description: + - Manage active directory group information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + state: + description: + - Whether the active directory group should exist or not, taking action if the state is different from what is stated. + choices: ['present', 'absent'] + default: present + type: str + name: + description: + - Enter the Role Group Name. This name identifies the role group in Active Directory. + type: str + required: true + domain: + description: + - Enter the Role Group Domain. This is the domain where the role group is located. + type: str + pri: + description: + - Enter the Role Group Privilege. This is the level of privilege to be assigned for this role group. + choices: ['administrator', 'user', 'operator', 'oem', 'none'] + type: str + kvm: + description: + - This field provides access to KVM for AD authenticated role group user. + choices: ['enable', 'disable'] + type: str + vm: + description: + - This field provides access to VMedia for AD authenticated role group user. + choices: ['enable', 'disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ad group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Add active directory group information" + kaytus.ksmanage.ad_group: + state: "present" + name: "wbs" + domain: "test.com" + pri: "administrator" + kvm: "enable" + vm: "disable" + provider: "{{ ksmanage }}" + + - name: "Set active directory group information" + kaytus.ksmanage.ad_group: + state: "present" + name: "wbs" + pri: "user" + kvm: "disable" + provider: "{{ ksmanage }}" + + - name: "Delete active directory group information" + kaytus.ksmanage.ad_group: + state: "absent" + name: "wbs" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AD(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'editadgroup' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + state=dict(type='str', choices=['present', 'absent'], default='present'), + name=dict(type='str', required=True), + domain=dict(type='str', required=False), + pri=dict(type='str', required=False, choices=['administrator', 'user', 'operator', 'oem', 'none']), + kvm=dict(type='str', required=False, choices=['enable', 'disable']), + vm=dict(type='str', required=False, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + ad_obj = AD(argument_spec) + ad_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group_info.py index 8db3d1d0a..4d64272a8 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_group_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ad_group_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get active directory group information
-description:
- - Get active directory group information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ad group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get active directory group information"
- kaytus.ksmanage.ad_group_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AD(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getadgroup'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ad_obj = AD(argument_spec)
- ad_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ad_group_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get active directory group information +description: + - Get active directory group information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ad group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get active directory group information" + kaytus.ksmanage.ad_group_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AD(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getadgroup' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ad_obj = AD(argument_spec) + ad_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_info.py index 37f7e2743..40823757d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ad_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ad_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ad_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get active directory information
-description:
- - Get active directory information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ad test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get active directory information"
- kaytus.ksmanage.ad_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AD(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getad'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ad_obj = AD(argument_spec)
- ad_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ad_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get active directory information +description: + - Get active directory information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ad test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get active directory information" + kaytus.ksmanage.ad_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AD(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getad' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ad_obj = AD(argument_spec) + ad_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/adapter_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/adapter_info.py index c9d9c6565..e478fe8d2 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/adapter_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/adapter_info.py @@ -1,119 +1,119 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: adapter_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get adapter information
-description:
- - Get adapter information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Adapter test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get adapter information"
- kaytus.ksmanage.adapter_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Adapter(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getnic'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- nic_result = self.results
- if nic_result['State'] == "Success":
- nic = nic_result['Message'][0]
- sysadapter_len = nic.get('Maximum', 0)
- idx = 0
- sortedRes = dict()
- if sysadapter_len > 0:
- nic = nic.get('NIC', [])
- List = []
- while idx < sysadapter_len:
- nic_info = nic[idx]
- sysadapter_info = nic_info.get('Controller')
- List.extend(sysadapter_info)
- idx = idx + 1
- sortedRes["State"] = "Success"
- sortedRes["Message"] = List
- else:
- sortedRes["State"] = "Failure"
- sortedRes["Message"] = "cannot get information"
- self.module.exit_json(**sortedRes)
- else:
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- adapter_obj = Adapter(argument_spec)
- adapter_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: adapter_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get adapter information +description: + - Get adapter information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Adapter test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get adapter information" + kaytus.ksmanage.adapter_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Adapter(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getnic' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + nic_result = self.results + if nic_result['State'] == "Success": + nic = nic_result['Message'][0] + sysadapter_len = nic.get('Maximum', 0) + idx = 0 + sortedRes = dict() + if sysadapter_len > 0: + nic = nic.get('NIC', []) + List = [] + while idx < sysadapter_len: + nic_info = nic[idx] + sysadapter_info = nic_info.get('Controller') + List.extend(sysadapter_info) + idx = idx + 1 + sortedRes["State"] = "Success" + sortedRes["Message"] = List + else: + sortedRes["State"] = "Failure" + sortedRes["Message"] = "cannot get information" + self.module.exit_json(**sortedRes) + else: + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + adapter_obj = Adapter(argument_spec) + adapter_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/add_ldisk.py b/ansible_collections/kaytus/ksmanage/plugins/modules/add_ldisk.py index c839c324b..7731849dd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/add_ldisk.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/add_ldisk.py @@ -1,221 +1,221 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: add_ldisk
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Create logical disk
-description:
- - Create logical disk on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- ctrl_id:
- description:
- - Raid controller ID.
- - Required when controller type is LSI, PMC or MV.
- type: int
- level:
- description:
- - RAID Level, 0 - RAID0, 1 - RAID1, 5 - RAID5, 6 - RAID6, 10 - RAID10.
- - Required when and controller type is LSI or PMC.
- choices: [0, 1, 5, 6, 10]
- type: int
- size:
- description:
- - Strip Size, 0 - 32k, 1 - 64k, 2 - 128k, 3 - 256k, 4 - 512k, 5 - 1024k.
- - Required when I(Info=None) and controller type is LSI, PMC or MV.
- - When the controller type is MV, size is [0, 1].
- - When the controller type is LSI or PMC, size is [1, 2, 3, 4, 5].
- choices: [0, 1, 2, 3, 4, 5]
- type: int
- access:
- description:
- - Access Policy, 1 - Read Write, 2 - Read Only, 3 - Blocked.
- - Required when controller type is LSI.
- choices: [1, 2, 3]
- type: int
- r:
- description:
- - Read Policy, 1 - Read Ahead, 2 - No Read Ahead.
- - Required when controller type is LSI.
- choices: [1, 2]
- type: int
- w:
- description:
- - Write Policy, 1 - Write Through, 2 - Write Back, 3 - Write caching ok if bad BBU.
- - Required when controller type is LSI.
- choices: [1, 2, 3]
- type: int
- io:
- description:
- - IO Policy, 1 - Direct IO, 2 - Cached IO.
- - Required when controller type is LSI.
- choices: [1, 2]
- type: int
- cache:
- description:
- - Drive Cache, 1 - Unchanged, 2 - Enabled, 3 - Disabled.
- - Required when controller type is LSI.
- choices: [1, 2, 3]
- type: int
- init:
- description:
- - Init State, 1 - No Init, 2 - Quick Init, 3 - Full Init.
- - Required when controller type is LSI.
- choices: [1, 2, 3]
- type: int
- select:
- description:
- - Select Size, from 1 to 100.
- - Required when controller type is LSI.
- type: int
- slot:
- description:
- - Slot Num, input multiple slotNumber like 0, 1, 2....
- - Required when controller type is LSI or PMC.
- type: list
- elements: int
- accelerator:
- description:
- - Driver accelerator, 1 - 1h, 2 - 2h, 3 - 3h.
- - Required when controller type is PMC.
- choices: [1, 2, 3]
- type: int
- vname:
- description:
- - Virtual drive name.
- - Required when controller type is PMC or server model is M7.
- - Required when controller type is MV.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Add ldisk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Add LSI ldisk"
- kaytus.ksmanage.add_ldisk:
- ctrl_id: 0
- level: 1
- size: 1
- access: 1
- r: 1
- w: 1
- io: 1
- cache: 1
- init: 2
- select: 10
- slot: 0, 1
- provider: "{{ ksmanage }}"
-
- - name: "Add PMC ldisk"
- kaytus.ksmanage.add_ldisk:
- ctrl_id: 0
- level: 1
- size: 1
- accelerator: 1
- slot: 0, 1
- vname: "test"
- provider: "{{ ksmanage }}"
-
- - name: "Add MV ldisk"
- kaytus.ksmanage.add_ldisk:
- ctrl_id: 0
- size: 1
- vname: "test"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'addldisk'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- ctrl_id=dict(type='int', required=False),
- level=dict(type='int', required=False, choices=[0, 1, 5, 6, 10]),
- size=dict(type='int', required=False, choices=[0, 1, 2, 3, 4, 5]),
- access=dict(type='int', required=False, choices=[1, 2, 3]),
- r=dict(type='int', required=False, choices=[1, 2]),
- w=dict(type='int', required=False, choices=[1, 2, 3]),
- io=dict(type='int', required=False, choices=[1, 2]),
- cache=dict(type='int', required=False, choices=[1, 2, 3]),
- init=dict(type='int', required=False, choices=[1, 2, 3]),
- select=dict(type='int', required=False),
- slot=dict(type='list', elements='int', required=False),
- accelerator=dict(type='int', required=False, choices=[1, 2, 3]),
- vname=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: add_ldisk +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Create logical disk +description: + - Create logical disk on kaytus Server. +notes: + - Does not support C(check_mode). +options: + ctrl_id: + description: + - Raid controller ID. + - Required when controller type is LSI, PMC or MV. + type: int + level: + description: + - RAID Level, 0 - RAID0, 1 - RAID1, 5 - RAID5, 6 - RAID6, 10 - RAID10. + - Required when and controller type is LSI or PMC. + choices: [0, 1, 5, 6, 10] + type: int + size: + description: + - Strip Size, 0 - 32k, 1 - 64k, 2 - 128k, 3 - 256k, 4 - 512k, 5 - 1024k. + - Required when I(Info=None) and controller type is LSI, PMC or MV. + - When the controller type is MV, size is [0, 1]. + - When the controller type is LSI or PMC, size is [1, 2, 3, 4, 5]. + choices: [0, 1, 2, 3, 4, 5] + type: int + access: + description: + - Access Policy, 1 - Read Write, 2 - Read Only, 3 - Blocked. + - Required when controller type is LSI. + choices: [1, 2, 3] + type: int + r: + description: + - Read Policy, 1 - Read Ahead, 2 - No Read Ahead. + - Required when controller type is LSI. + choices: [1, 2] + type: int + w: + description: + - Write Policy, 1 - Write Through, 2 - Write Back, 3 - Write caching ok if bad BBU. + - Required when controller type is LSI. + choices: [1, 2, 3] + type: int + io: + description: + - IO Policy, 1 - Direct IO, 2 - Cached IO. + - Required when controller type is LSI. + choices: [1, 2] + type: int + cache: + description: + - Drive Cache, 1 - Unchanged, 2 - Enabled, 3 - Disabled. + - Required when controller type is LSI. + choices: [1, 2, 3] + type: int + init: + description: + - Init State, 1 - No Init, 2 - Quick Init, 3 - Full Init. + - Required when controller type is LSI. + choices: [1, 2, 3] + type: int + select: + description: + - Select Size, from 1 to 100. + - Required when controller type is LSI. + type: int + slot: + description: + - Slot Num, input multiple slotNumber like 0, 1, 2.... + - Required when controller type is LSI or PMC. + type: list + elements: int + accelerator: + description: + - Driver accelerator, 1 - 1h, 2 - 2h, 3 - 3h. + - Required when controller type is PMC. + choices: [1, 2, 3] + type: int + vname: + description: + - Virtual drive name. + - Required when controller type is PMC or server model is M7. + - Required when controller type is MV. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Add ldisk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Add LSI ldisk" + kaytus.ksmanage.add_ldisk: + ctrl_id: 0 + level: 1 + size: 1 + access: 1 + r: 1 + w: 1 + io: 1 + cache: 1 + init: 2 + select: 10 + slot: 0, 1 + provider: "{{ ksmanage }}" + + - name: "Add PMC ldisk" + kaytus.ksmanage.add_ldisk: + ctrl_id: 0 + level: 1 + size: 1 + accelerator: 1 + slot: 0, 1 + vname: "test" + provider: "{{ ksmanage }}" + + - name: "Add MV ldisk" + kaytus.ksmanage.add_ldisk: + ctrl_id: 0 + size: 1 + vname: "test" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'addldisk' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + ctrl_id=dict(type='int', required=False), + level=dict(type='int', required=False, choices=[0, 1, 5, 6, 10]), + size=dict(type='int', required=False, choices=[0, 1, 2, 3, 4, 5]), + access=dict(type='int', required=False, choices=[1, 2, 3]), + r=dict(type='int', required=False, choices=[1, 2]), + w=dict(type='int', required=False, choices=[1, 2, 3]), + io=dict(type='int', required=False, choices=[1, 2]), + cache=dict(type='int', required=False, choices=[1, 2, 3]), + init=dict(type='int', required=False, choices=[1, 2, 3]), + select=dict(type='int', required=False), + slot=dict(type='list', elements='int', required=False), + accelerator=dict(type='int', required=False, choices=[1, 2, 3]), + vname=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/alert_policy_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/alert_policy_info.py index e807902b8..23bf6958c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/alert_policy_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/alert_policy_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: alert_policy_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get alert policy
-description:
- - Get alert policy on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Alert test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get alert policy"
- kaytus.ksmanage.alert_policy_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getalertpolicy'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: alert_policy_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get alert policy +description: + - Get alert policy on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Alert test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get alert policy" + kaytus.ksmanage.alert_policy_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getalertpolicy' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/audit_log_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/audit_log_info.py index 263c7e5fe..46e2671bb 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/audit_log_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/audit_log_info.py @@ -1,126 +1,126 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: audit_log_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get BMC audit log information
-description:
- - Get BMC audit log information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options:
- log_time:
- description:
- - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00.
- type: str
- count:
- description:
- - Get the most recent log of a specified number.
- type: int
- audit_file:
- description:
- - Store logs to a file.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bmc audit log test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bmc audit log information"
- kaytus.ksmanage.audit_log_info:
- log_time: "2020-06-01T12:30+08:00"
- provider: "{{ ksmanage }}"
-
- - name: "Get bmc audit log information"
- kaytus.ksmanage.audit_log_info:
- count: 30
- provider: "{{ ksmanage }}"
-
- - name: "Get bmc audit log information"
- kaytus.ksmanage.audit_log_info:
- audit_file: "/home/wbs/wbs.log"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AuditLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getauditlog'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- log_time=dict(type='str', required=False),
- count=dict(type='int', required=False),
- audit_file=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = AuditLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: audit_log_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get BMC audit log information +description: + - Get BMC audit log information on kaytus Server. +notes: + - Supports C(check_mode). +options: + log_time: + description: + - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00. + type: str + count: + description: + - Get the most recent log of a specified number. + type: int + audit_file: + description: + - Store logs to a file. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bmc audit log test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bmc audit log information" + kaytus.ksmanage.audit_log_info: + log_time: "2020-06-01T12:30+08:00" + provider: "{{ ksmanage }}" + + - name: "Get bmc audit log information" + kaytus.ksmanage.audit_log_info: + count: 30 + provider: "{{ ksmanage }}" + + - name: "Get bmc audit log information" + kaytus.ksmanage.audit_log_info: + audit_file: "/home/wbs/wbs.log" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AuditLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getauditlog' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + log_time=dict(type='str', required=False), + count=dict(type='int', required=False), + audit_file=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = AuditLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/auto_capture_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/auto_capture_info.py index deeb416c4..d20ebb4fd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/auto_capture_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/auto_capture_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: auto_capture_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get auto capture screen information
-description:
- - Get auto capture screen information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Screen test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get auto capture screen information"
- kaytus.ksmanage.auto_capture_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Screen(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getscreen'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- screen_obj = Screen(argument_spec)
- screen_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: auto_capture_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get auto capture screen information +description: + - Get auto capture screen information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Screen test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get auto capture screen information" + kaytus.ksmanage.auto_capture_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Screen(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getscreen' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + screen_obj = Screen(argument_spec) + screen_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/backplane_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/backplane_info.py index cfce77c78..e3dd9ebc1 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/backplane_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/backplane_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: backplane_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get disk backplane information
-description:
- - Get disk backplane information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Disk backplane test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get backplane information"
- kaytus.ksmanage.backplane_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Backplane(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getbackplane'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- back_obj = Backplane(argument_spec)
- back_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: backplane_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get disk backplane information +description: + - Get disk backplane information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Disk backplane test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get backplane information" + kaytus.ksmanage.backplane_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Backplane(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getbackplane' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + back_obj = Backplane(argument_spec) + back_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/backup.py b/ansible_collections/kaytus/ksmanage/plugins/modules/backup.py index 13023d0ad..3f4a17856 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/backup.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/backup.py @@ -1,120 +1,120 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: backup
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Backup server settings
-description:
- - Backup server settings on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- bak_file:
- description:
- - Backup file or bak folder.
- required: true
- type: str
- item:
- description:
- - Export item.
- - The values for M5 modules are 'all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap', 'user', 'bios'.
- - The values for M6 modules are 'all', 'network', 'service', 'ntp', 'snmptrap', 'kvm', 'ipmi', 'authentication', 'syslog'.
- - The values for M7 modules are 'all', 'network', 'service', 'syslog', 'ncsi'.
- choices: ['all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap',
- 'user', 'bios', 'kvm', 'ipmi', 'authentication', 'syslog', 'ncsi']
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Backup test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Backup server settings"
- kaytus.ksmanage.backup:
- bak_file: "/home/wbs/"
- item: "all"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Backup(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'backup'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- bak_file=dict(type='str', required=True),
- item=dict(type='str', required=True, choices=['all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad',
- 'ldap', 'user', 'bios', 'kvm', 'ipmi', 'authentication', 'syslog', 'ncsi']),
- )
- argument_spec.update(ksmanage_argument_spec)
- backup_obj = Backup(argument_spec)
- backup_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: backup +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Backup server settings +description: + - Backup server settings on kaytus Server. +notes: + - Does not support C(check_mode). +options: + bak_file: + description: + - Backup file or bak folder. + required: true + type: str + item: + description: + - Export item. + - The values for M5 modules are 'all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap', 'user', 'bios'. + - The values for M6 modules are 'all', 'network', 'service', 'ntp', 'snmptrap', 'kvm', 'ipmi', 'authentication', 'syslog'. + - The values for M7 modules are 'all', 'network', 'service', 'syslog', 'ncsi'. + choices: ['all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap', + 'user', 'bios', 'kvm', 'ipmi', 'authentication', 'syslog', 'ncsi'] + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Backup test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Backup server settings" + kaytus.ksmanage.backup: + bak_file: "/home/wbs/" + item: "all" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Backup(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'backup' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + bak_file=dict(type='str', required=True), + item=dict(type='str', required=True, choices=['all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', + 'ldap', 'user', 'bios', 'kvm', 'ipmi', 'authentication', 'syslog', 'ncsi']), + ) + argument_spec.update(ksmanage_argument_spec) + backup_obj = Backup(argument_spec) + backup_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_export.py b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_export.py index 6934504f2..8234d16f4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_export.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_export.py @@ -1,107 +1,107 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: bios_export
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Export BIOS config
-description:
- - Export BIOS config on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - Suffix is .json/.conf, FILEURI format, "/directory/filename".
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bios test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Export bios config"
- kaytus.ksmanage.bios_export:
- file_url: "/home/wbs/bios.conf"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'exportbioscfg'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: bios_export +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Export BIOS config +description: + - Export BIOS config on kaytus Server. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - Suffix is .json/.conf, FILEURI format, "/directory/filename". + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bios test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Export bios config" + kaytus.ksmanage.bios_export: + file_url: "/home/wbs/bios.conf" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'exportbioscfg' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_import.py b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_import.py index bbb226448..ba0fa7971 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_import.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_import.py @@ -1,109 +1,109 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: bios_import
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Import BIOS config
-description:
- - Import BIOS config on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - Suffix is .json/.conf, FILEURI format, "/directory/filename".
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bios test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Import bios config"
- kaytus.ksmanage.bios_import:
- file_url: "/home/wbs/bios.conf"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'importbioscfg'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: bios_import +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Import BIOS config +description: + - Import BIOS config on kaytus Server. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - Suffix is .json/.conf, FILEURI format, "/directory/filename". + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bios test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Import bios config" + kaytus.ksmanage.bios_import: + file_url: "/home/wbs/bios.conf" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'importbioscfg' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_info.py index b55094fbf..1dde06bd6 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/bios_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/bios_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: bios_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get BIOS setup
-description:
- - Get BIOS setup on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bios test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bios setup"
- kaytus.ksmanage.bios_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getbios'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: bios_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get BIOS setup +description: + - Get BIOS setup on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bios test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bios setup" + kaytus.ksmanage.bios_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getbios' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/bmc_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/bmc_info.py index feb205002..e1c65ffa8 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/bmc_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/bmc_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: bmc_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get BMC information
-description:
- - Get BMC information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bmc info test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get BMC information"
- kaytus.ksmanage.bmc_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BMCInfo(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getbmcinfo'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- bmc_obj = BMCInfo(argument_spec)
- bmc_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: bmc_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get BMC information +description: + - Get BMC information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bmc info test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get BMC information" + kaytus.ksmanage.bmc_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BMCInfo(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getbmcinfo' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + bmc_obj = BMCInfo(argument_spec) + bmc_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/boot_image_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/boot_image_info.py index b9a8c2f68..e9bab6257 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/boot_image_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/boot_image_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: boot_image_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get bmc boot image information
-description:
- - Get bmc boot image information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Boot image test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bmc boot image information"
- kaytus.ksmanage.boot_image_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Image(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getbootimage'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- image_obj = Image(argument_spec)
- image_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: boot_image_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get bmc boot image information +description: + - Get bmc boot image information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Boot image test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bmc boot image information" + kaytus.ksmanage.boot_image_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Image(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getbootimage' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + image_obj = Image(argument_spec) + image_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/boot_option_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/boot_option_info.py index 58b013fc2..f963d2811 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/boot_option_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/boot_option_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: boot_option_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get BIOS boot options
-description:
- - Get BIOS boot options on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Boot test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bios boot option"
- kaytus.ksmanage.boot_option_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsysboot'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: boot_option_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get BIOS boot options +description: + - Get BIOS boot options on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Boot test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bios boot option" + kaytus.ksmanage.boot_option_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsysboot' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_audit_log.py b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_audit_log.py index 7b3bb25af..71189f981 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_audit_log.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_audit_log.py @@ -1,101 +1,101 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: clear_audit_log
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Clear BMC audit log
-description:
- - Clear BMC audit log on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Clear BMC audit log test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Clear BMC audit log "
- kaytus.ksmanage.clear_audit_log:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AuditLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'clearauditlog'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- log_obj = AuditLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: clear_audit_log +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Clear BMC audit log +description: + - Clear BMC audit log on kaytus Server. +notes: + - Does not support C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Clear BMC audit log test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Clear BMC audit log " + kaytus.ksmanage.clear_audit_log: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AuditLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'clearauditlog' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + log_obj = AuditLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_event_log.py b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_event_log.py index 8648ef256..511724843 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_event_log.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_event_log.py @@ -1,101 +1,101 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: clear_event_log
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Clear event log
-description:
- - Clear event log on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Clear event log test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Clear event log"
- kaytus.ksmanage.clear_event_log:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class EventLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'cleareventlog'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- log_obj = EventLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: clear_event_log +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Clear event log +description: + - Clear event log on kaytus Server. +notes: + - Does not support C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Clear event log test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Clear event log" + kaytus.ksmanage.clear_event_log: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class EventLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'cleareventlog' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + log_obj = EventLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_system_log.py b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_system_log.py index ac7b573bf..048a2c31a 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/clear_system_log.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/clear_system_log.py @@ -1,115 +1,115 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: clear_system_log
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Clear BMC system log
-description:
- - Clear BMC system log on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- level:
- description:
- - Log level.
- default: alert
- choices: ['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info', 'all']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Clear BMC system log test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Clear BMC system log"
- kaytus.ksmanage.clear_system_log:
- level: "alert"
- provider: "{{ ksmanage }}"
-
- - name: "Clear BMC system log"
- kaytus.ksmanage.clear_system_log:
- level: "all"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SystemLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'clearsystemlog'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- level=dict(type='str', default='alert', choices=['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info', 'all']),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = SystemLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: clear_system_log +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Clear BMC system log +description: + - Clear BMC system log on kaytus Server. +notes: + - Does not support C(check_mode). +options: + level: + description: + - Log level. + default: alert + choices: ['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info', 'all'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Clear BMC system log test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Clear BMC system log" + kaytus.ksmanage.clear_system_log: + level: "alert" + provider: "{{ ksmanage }}" + + - name: "Clear BMC system log" + kaytus.ksmanage.clear_system_log: + level: "all" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SystemLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'clearsystemlog' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + level=dict(type='str', default='alert', choices=['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info', 'all']), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = SystemLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/collect_blackbox.py b/ansible_collections/kaytus/ksmanage/plugins/modules/collect_blackbox.py index 19d2a904b..8dd8a646d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/collect_blackbox.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/collect_blackbox.py @@ -1,108 +1,108 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: collect_blackbox
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Collect blackbox log
-description:
- - Collect blackbox log on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - File download path.
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Collect blackbox test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Collect blackbox log"
- kaytus.ksmanage.collect_blackbox:
- file_url: "/home/wbs/wbs.log"
- provider: "{{ ksmanage }}"
-
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Blackbox(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'collectblackbox'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = Blackbox(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: collect_blackbox +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Collect blackbox log +description: + - Collect blackbox log on kaytus Server. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - File download path. + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Collect blackbox test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Collect blackbox log" + kaytus.ksmanage.collect_blackbox: + file_url: "/home/wbs/wbs.log" + provider: "{{ ksmanage }}" + +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Blackbox(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'collectblackbox' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = Blackbox(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/collect_log.py b/ansible_collections/kaytus/ksmanage/plugins/modules/collect_log.py index a8f3c71ad..706dc79f2 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/collect_log.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/collect_log.py @@ -1,107 +1,107 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: collect_log
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Collect logs
-description:
- - Collect logs on kaytus Server, it takes about 5 minutes.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - File download path or path with filename, for example filepath/filename.tar.
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Collect test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Collect logs"
- kaytus.ksmanage.collect_log:
- file_url: "/home/wbs/test.tar"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Log(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'collect'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = Log(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: collect_log +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Collect logs +description: + - Collect logs on kaytus Server, it takes about 5 minutes. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - File download path or path with filename, for example filepath/filename.tar. + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Collect test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Collect logs" + kaytus.ksmanage.collect_log: + file_url: "/home/wbs/test.tar" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Log(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'collect' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = Log(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/connect_media_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/connect_media_info.py index a4f7e6e33..ebb16553f 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/connect_media_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/connect_media_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: connect_media_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get remote images redirection information
-description:
- - Get remote images redirection information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Connect media test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get remote images redirection information"
- kaytus.ksmanage.connect_media_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Connect(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getconnectmedia'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- connect_obj = Connect(argument_spec)
- connect_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: connect_media_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get remote images redirection information +description: + - Get remote images redirection information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Connect media test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get remote images redirection information" + kaytus.ksmanage.connect_media_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Connect(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getconnectmedia' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + connect_obj = Connect(argument_spec) + connect_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/cpu_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/cpu_info.py index 1f57a6218..f4a78961c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/cpu_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/cpu_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: cpu_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get CPU information
-description:
- - Get CPU information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: CPU test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get cpu information"
- kaytus.ksmanage.cpu_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class CPU(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getcpu'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- cpu_obj = CPU(argument_spec)
- cpu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: cpu_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get CPU information +description: + - Get CPU information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: CPU test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get cpu information" + kaytus.ksmanage.cpu_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class CPU(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getcpu' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + cpu_obj = CPU(argument_spec) + cpu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/del_session.py b/ansible_collections/kaytus/ksmanage/plugins/modules/del_session.py index cbf698d0a..f5445dfc6 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/del_session.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/del_session.py @@ -1,109 +1,109 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: del_session
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Delete session
-description:
- - Delete session on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- sid:
- description:
- - Session Id, input "all" to delete all sessions.
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Delete session test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Delete session"
- kaytus.ksmanage.del_session:
- sid: "223"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Session(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'delsession'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- sid=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- session_obj = Session(argument_spec)
- session_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: del_session +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Delete session +description: + - Delete session on kaytus Server. +notes: + - Does not support C(check_mode). +options: + sid: + description: + - Session Id, input "all" to delete all sessions. + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Delete session test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Delete session" + kaytus.ksmanage.del_session: + sid: "223" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Session(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'delsession' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + sid=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + session_obj = Session(argument_spec) + session_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/dns_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/dns_info.py index ea537808c..fad4ee6af 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/dns_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/dns_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: dns_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get dns information
-description:
- - Get dns information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: DNS test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get dns information"
- kaytus.ksmanage.dns_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class DNS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getdns'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- dns_obj = DNS(argument_spec)
- dns_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: dns_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get dns information +description: + - Get dns information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: DNS test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get dns information" + kaytus.ksmanage.dns_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class DNS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getdns' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + dns_obj = DNS(argument_spec) + dns_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/download_auto_screenshot.py b/ansible_collections/kaytus/ksmanage/plugins/modules/download_auto_screenshot.py index 1b31074d5..a6d06cf02 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/download_auto_screenshot.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/download_auto_screenshot.py @@ -1,107 +1,107 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: download_auto_screenshot
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Download auto screenshots
-description:
- - Download auto screenshots on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - Screen capture file path.
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Screen test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Download auto screenshots"
- kaytus.ksmanage.download_auto_screenshot:
- file_url: "/home/wbs/screen"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Screen(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'downscreen'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- screen_obj = Screen(argument_spec)
- screen_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: download_auto_screenshot +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Download auto screenshots +description: + - Download auto screenshots on kaytus Server. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - Screen capture file path. + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Screen test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Download auto screenshots" + kaytus.ksmanage.download_auto_screenshot: + file_url: "/home/wbs/screen" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Screen(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'downscreen' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + screen_obj = Screen(argument_spec) + screen_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/download_manual_screenshot.py b/ansible_collections/kaytus/ksmanage/plugins/modules/download_manual_screenshot.py index d9b960dbe..5294b98b4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/download_manual_screenshot.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/download_manual_screenshot.py @@ -1,107 +1,107 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: download_manual_screenshot
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Download manual screenshots
-description:
- - Download manual screenshots on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- file_url:
- description:
- - Screen capture file path.
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Screen test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Download manual screenshots"
- kaytus.ksmanage.download_manual_screenshot:
- file_url: "/home/wbs/screen"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Screen(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'downscreenmanual'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- file_url=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- screen_obj = Screen(argument_spec)
- screen_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: download_manual_screenshot +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Download manual screenshots +description: + - Download manual screenshots on kaytus Server. +notes: + - Does not support C(check_mode). +options: + file_url: + description: + - Screen capture file path. + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Screen test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Download manual screenshots" + kaytus.ksmanage.download_manual_screenshot: + file_url: "/home/wbs/screen" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Screen(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'downscreenmanual' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + file_url=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + screen_obj = Screen(argument_spec) + screen_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ad.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ad.py index 86d195996..375ff6bae 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ad.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ad.py @@ -1,163 +1,163 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ad
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set active directory information
-description:
- - Set active directory information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- enable:
- description:
- - Active Directory Authentication Status.
- choices: ['enable', 'disable']
- type: str
- ssl_enable:
- description:
- - Active Directory SSL Status.
- choices: ['enable', 'disable']
- type: str
- name:
- description:
- - Secret Username. Specify the Username of an administrator of the Active Directory Server.
- type: str
- code:
- description:
- - Secret Password. Specify the Password of the administrator.
- type: str
- timeout:
- description:
- - The Time Out configuration(15-300).
- - Only the M5 model supports this parameter.
- type: int
- domain:
- description:
- - User Domain Name. Specify the Domain Name for the user for example MyDomain.com.
- type: str
- addr1:
- description:
- - Domain Controller Server Address1. Enter the IP address of Active Directory server.
- type: str
- addr2:
- description:
- - Domain Controller Server Address2. Enter the IP address of Active Directory server.
- type: str
- addr3:
- description:
- - Domain Controller Server Address3. Enter the IP address of Active Directory server.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ad test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set active directory information"
- kaytus.ksmanage.edit_ad:
- enable: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set active directory information"
- kaytus.ksmanage.edit_ad:
- enable: "enable"
- name: "test"
- code: "123456"
- timeout: 120
- domain: "test.com"
- addr1: "100.2.2.2"
- addr2: "100.2.2.3"
- addr3: "100.2.2.4"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class AD(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setad'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- enable=dict(type='str', required=False, choices=['enable', 'disable']),
- ssl_enable=dict(type='str', required=False, choices=['enable', 'disable']),
- name=dict(type='str', required=False),
- code=dict(type='str', required=False),
- timeout=dict(type='int', required=False),
- domain=dict(type='str', required=False),
- addr1=dict(type='str', required=False),
- addr2=dict(type='str', required=False),
- addr3=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- ad_obj = AD(argument_spec)
- ad_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ad +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set active directory information +description: + - Set active directory information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + enable: + description: + - Active Directory Authentication Status. + choices: ['enable', 'disable'] + type: str + ssl_enable: + description: + - Active Directory SSL Status. + choices: ['enable', 'disable'] + type: str + name: + description: + - Secret Username. Specify the Username of an administrator of the Active Directory Server. + type: str + code: + description: + - Secret Password. Specify the Password of the administrator. + type: str + timeout: + description: + - The Time Out configuration(15-300). + - Only the M5 model supports this parameter. + type: int + domain: + description: + - User Domain Name. Specify the Domain Name for the user for example MyDomain.com. + type: str + addr1: + description: + - Domain Controller Server Address1. Enter the IP address of Active Directory server. + type: str + addr2: + description: + - Domain Controller Server Address2. Enter the IP address of Active Directory server. + type: str + addr3: + description: + - Domain Controller Server Address3. Enter the IP address of Active Directory server. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ad test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set active directory information" + kaytus.ksmanage.edit_ad: + enable: "disable" + provider: "{{ ksmanage }}" + + - name: "Set active directory information" + kaytus.ksmanage.edit_ad: + enable: "enable" + name: "test" + code: "123456" + timeout: 120 + domain: "test.com" + addr1: "100.2.2.2" + addr2: "100.2.2.3" + addr3: "100.2.2.4" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class AD(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setad' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + enable=dict(type='str', required=False, choices=['enable', 'disable']), + ssl_enable=dict(type='str', required=False, choices=['enable', 'disable']), + name=dict(type='str', required=False), + code=dict(type='str', required=False), + timeout=dict(type='int', required=False), + domain=dict(type='str', required=False), + addr1=dict(type='str', required=False), + addr2=dict(type='str', required=False), + addr3=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + ad_obj = AD(argument_spec) + ad_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_alert_policy.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_alert_policy.py index 0739c11e7..25981a72c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_alert_policy.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_alert_policy.py @@ -1,156 +1,156 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_alert_policy
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set alert policy
-description:
- - Set alert policy on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- id:
- description:
- - Alert id. Customize the channel for sending alarms in Trap.
- - The values for M5 modules are 1, 2, 3.
- - The values for M6 modules are 1, 2, 3, 4.
- choices: [1, 2, 3, 4]
- required: true
- type: int
- status:
- description:
- - Alert policy status. Whether to enable the receiving end for sending messages in trap mode.
- choices: ['enable', 'disable']
- type: str
- type:
- description:
- - Alert Type.
- - Only the M5 model supports this parameter.
- choices: ['snmp', 'email', 'snmpdomain']
- type: str
- destination:
- description:
- - Alert destination. The address of the server receiving trap information sent by Trap.
- - when type is snmp, specify an IP address.
- - When type is email, specify a username.
- - When type is snmpdomain, specify a domain.
- type: str
- channel:
- description:
- - LAN Channel.
- - Only the M5 model supports this parameter.
- choices: ['shared', 'dedicated']
- type: str
- trap_port:
- description:
- - SNMP trap port(1-65535).
- - Only the M6 model supports this parameter.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Alert policy test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set alert policy"
- kaytus.ksmanage.edit_alert_policy:
- id: 1
- status: "enable"
- type: "snmp"
- destination: "100.2.2.2"
- channel: "shared"
- provider: "{{ ksmanage }}"
-
- - name: "Set alert policy"
- kaytus.ksmanage.edit_alert_policy:
- id: 1
- status: "disable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setalertpolicy'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- id=dict(type='int', required=True, choices=[1, 2, 3, 4]),
- status=dict(type='str', required=False, choices=['enable', 'disable']),
- type=dict(type='str', required=False, choices=['snmp', 'email', 'snmpdomain']),
- destination=dict(type='str', required=False),
- channel=dict(type='str', required=False, choices=['shared', 'dedicated']),
- trap_port=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_alert_policy +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set alert policy +description: + - Set alert policy on kaytus Server. +notes: + - Does not support C(check_mode). +options: + id: + description: + - Alert id. Customize the channel for sending alarms in Trap. + - The values for M5 modules are 1, 2, 3. + - The values for M6 modules are 1, 2, 3, 4. + choices: [1, 2, 3, 4] + required: true + type: int + status: + description: + - Alert policy status. Whether to enable the receiving end for sending messages in trap mode. + choices: ['enable', 'disable'] + type: str + type: + description: + - Alert Type. + - Only the M5 model supports this parameter. + choices: ['snmp', 'email', 'snmpdomain'] + type: str + destination: + description: + - Alert destination. The address of the server receiving trap information sent by Trap. + - when type is snmp, specify an IP address. + - When type is email, specify a username. + - When type is snmpdomain, specify a domain. + type: str + channel: + description: + - LAN Channel. + - Only the M5 model supports this parameter. + choices: ['shared', 'dedicated'] + type: str + trap_port: + description: + - SNMP trap port(1-65535). + - Only the M6 model supports this parameter. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Alert policy test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set alert policy" + kaytus.ksmanage.edit_alert_policy: + id: 1 + status: "enable" + type: "snmp" + destination: "100.2.2.2" + channel: "shared" + provider: "{{ ksmanage }}" + + - name: "Set alert policy" + kaytus.ksmanage.edit_alert_policy: + id: 1 + status: "disable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setalertpolicy' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + id=dict(type='int', required=True, choices=[1, 2, 3, 4]), + status=dict(type='str', required=False, choices=['enable', 'disable']), + type=dict(type='str', required=False, choices=['snmp', 'email', 'snmpdomain']), + destination=dict(type='str', required=False), + channel=dict(type='str', required=False, choices=['shared', 'dedicated']), + trap_port=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_auto_capture.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_auto_capture.py index 379c1612f..2c5421b0e 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_auto_capture.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_auto_capture.py @@ -1,110 +1,110 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_auto_capture
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set auto capture screen
-description:
- - Set auto capture screen on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- status:
- description:
- - Capture status.
- choices: ['enable', 'disable']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Screen test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set auto capture screen"
- kaytus.ksmanage.edit_auto_capture:
- status: "enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Screen(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setscreen'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- status=dict(type='str', required=True, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- screen_obj = Screen(argument_spec)
- screen_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_auto_capture +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set auto capture screen +description: + - Set auto capture screen on kaytus Server. +notes: + - Does not support C(check_mode). +options: + status: + description: + - Capture status. + choices: ['enable', 'disable'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Screen test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set auto capture screen" + kaytus.ksmanage.edit_auto_capture: + status: "enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Screen(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setscreen' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + status=dict(type='str', required=True, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + screen_obj = Screen(argument_spec) + screen_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_bios.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_bios.py index 09b6b87d6..3422ecb3c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_bios.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_bios.py @@ -1,134 +1,134 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_bios
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set BIOS setup attributes
-description:
- - Set BIOS setup attributes on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- list:
- description:
- - Show attribute name and configurable value.
- default: False
- type: bool
- attribute:
- description:
- - BIOS setup option.
- - Required when I(list=False) and I(file_url=None).
- type: str
- value:
- description:
- - BIOS setup option value.
- - Required when I(list=False) and I(file_url=None).
- type: str
- file_url:
- description:
- - BIOS option file. attribute must be used with value.
- - Mutually exclusive with fileurl format, "/directory/filename".
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bios test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set bios setup"
- kaytus.ksmanage.edit_bios:
- attribute: "VMX"
- value: "Disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set bios setup"
- kaytus.ksmanage.edit_bios:
- attribute: "VMX"
- value: "Enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setbios'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- list=dict(type='bool', required=False, default=False),
- attribute=dict(type='str', required=False),
- value=dict(type='str', required=False),
- file_url=dict(type='str', required=False)
- )
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_bios +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set BIOS setup attributes +description: + - Set BIOS setup attributes on kaytus Server. +notes: + - Does not support C(check_mode). +options: + list: + description: + - Show attribute name and configurable value. + default: False + type: bool + attribute: + description: + - BIOS setup option. + - Required when I(list=False) and I(file_url=None). + type: str + value: + description: + - BIOS setup option value. + - Required when I(list=False) and I(file_url=None). + type: str + file_url: + description: + - BIOS option file. attribute must be used with value. + - Mutually exclusive with fileurl format, "/directory/filename". + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bios test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set bios setup" + kaytus.ksmanage.edit_bios: + attribute: "VMX" + value: "Disable" + provider: "{{ ksmanage }}" + + - name: "Set bios setup" + kaytus.ksmanage.edit_bios: + attribute: "VMX" + value: "Enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setbios' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + list=dict(type='bool', required=False, default=False), + attribute=dict(type='str', required=False), + value=dict(type='str', required=False), + file_url=dict(type='str', required=False) + ) + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_image.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_image.py index 799f71687..a468f52ac 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_image.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_image.py @@ -1,111 +1,111 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_boot_image
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set bmc boot image
-description:
- - Set bmc boot image on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- image:
- description:
- - BMC boot image.
- - 0-Higher firmware version; 1-Image 1; 2-Image 2; 3-Lower firmware version; 4-Latest updated firmware; 5-Not latest updated firmware.
- choices: [0, 1, 2, 3, 4, 5]
- type: int
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Boot image test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set bmc boot image"
- kaytus.ksmanage.edit_boot_image:
- image: 2
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Image(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setbootimage'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- image=dict(type='int', required=True, choices=[0, 1, 2, 3, 4, 5]),
- )
- argument_spec.update(ksmanage_argument_spec)
- image_obj = Image(argument_spec)
- image_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_boot_image +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set bmc boot image +description: + - Set bmc boot image on kaytus Server. +notes: + - Does not support C(check_mode). +options: + image: + description: + - BMC boot image. + - 0-Higher firmware version; 1-Image 1; 2-Image 2; 3-Lower firmware version; 4-Latest updated firmware; 5-Not latest updated firmware. + choices: [0, 1, 2, 3, 4, 5] + type: int + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Boot image test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set bmc boot image" + kaytus.ksmanage.edit_boot_image: + image: 2 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Image(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setbootimage' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + image=dict(type='int', required=True, choices=[0, 1, 2, 3, 4, 5]), + ) + argument_spec.update(ksmanage_argument_spec) + image_obj = Image(argument_spec) + image_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_option.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_option.py index 1a2cd56ee..c9e922c50 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_option.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_boot_option.py @@ -1,123 +1,123 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_boot_option
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set BIOS boot options
-description:
- - Set BIOS boot options on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- device:
- description:
- - Boot device.
- choices: ['none', 'HDD', 'PXE', 'CD', 'BIOSSETUP']
- type: str
- effective:
- description:
- - Effective, once or continuous.
- choices: ['Once', 'Continuous']
- type: str
- mode:
- description:
- - Boot type.
- choices: ['Legacy', 'UEFI']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Boot test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set bios boot option"
- kaytus.ksmanage.edit_boot_option:
- device: "PXE"
- effective: "Once"
- mode: "Legacy"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class BIOS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsysboot'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- device=dict(type='str', required=False, choices=['none', 'HDD', 'PXE', 'CD', 'BIOSSETUP']),
- effective=dict(type='str', required=False, choices=['Once', 'Continuous']),
- mode=dict(type='str', required=False, choices=['Legacy', 'UEFI'])
- )
- argument_spec.update(ksmanage_argument_spec)
- bios_obj = BIOS(argument_spec)
- bios_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_boot_option +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set BIOS boot options +description: + - Set BIOS boot options on kaytus Server. +notes: + - Does not support C(check_mode). +options: + device: + description: + - Boot device. + choices: ['none', 'HDD', 'PXE', 'CD', 'BIOSSETUP'] + type: str + effective: + description: + - Effective, once or continuous. + choices: ['Once', 'Continuous'] + type: str + mode: + description: + - Boot type. + choices: ['Legacy', 'UEFI'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Boot test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set bios boot option" + kaytus.ksmanage.edit_boot_option: + device: "PXE" + effective: "Once" + mode: "Legacy" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class BIOS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsysboot' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + device=dict(type='str', required=False, choices=['none', 'HDD', 'PXE', 'CD', 'BIOSSETUP']), + effective=dict(type='str', required=False, choices=['Once', 'Continuous']), + mode=dict(type='str', required=False, choices=['Legacy', 'UEFI']) + ) + argument_spec.update(ksmanage_argument_spec) + bios_obj = BIOS(argument_spec) + bios_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_connect_media.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_connect_media.py index 1dca09259..a98f2589c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_connect_media.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_connect_media.py @@ -1,126 +1,126 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_connect_media
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Start/Stop virtual media Image
-description:
- - Start/Stop virtual media Image on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- image_type:
- description:
- - Virtual media type.
- - Only the M5 model supports this parameter.
- choices: ['CD', 'FD', 'HD']
- type: str
- required: true
- op_type:
- description:
- - Start or stop media.
- choices: ['start', 'stop']
- type: str
- required: true
- image_name:
- description:
- - Image name.
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Connect media test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set remote image redirection"
- kaytus.ksmanage.edit_connect_media:
- image_type: "CD"
- op_type: "start"
- image_name: "aa.iso"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Connect(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setconnectmedia'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- image_type=dict(type='str', required=True, choices=['CD', 'FD', 'HD']),
- op_type=dict(type='str', required=True, choices=['start', 'stop']),
- image_name=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- connect_obj = Connect(argument_spec)
- connect_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_connect_media +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Start/Stop virtual media Image +description: + - Start/Stop virtual media Image on kaytus Server. +notes: + - Does not support C(check_mode). +options: + image_type: + description: + - Virtual media type. + - Only the M5 model supports this parameter. + choices: ['CD', 'FD', 'HD'] + type: str + required: true + op_type: + description: + - Start or stop media. + choices: ['start', 'stop'] + type: str + required: true + image_name: + description: + - Image name. + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Connect media test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set remote image redirection" + kaytus.ksmanage.edit_connect_media: + image_type: "CD" + op_type: "start" + image_name: "aa.iso" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Connect(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setconnectmedia' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + image_type=dict(type='str', required=True, choices=['CD', 'FD', 'HD']), + op_type=dict(type='str', required=True, choices=['start', 'stop']), + image_name=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + connect_obj = Connect(argument_spec) + connect_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_dns.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_dns.py index 171890488..8fddfb240 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_dns.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_dns.py @@ -1,231 +1,231 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_dns
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set dns information
-description:
- - Set dns information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- dns_status:
- description:
- - DNS status.
- choices: ['enable', 'disable']
- type: str
- host_cfg:
- description:
- - Host Settings. Select whether the host name will be configured manually or automatically.
- choices: ['manual', 'auto']
- type: str
- host_name:
- description:
- - Host Name.
- - Required when I(host_cfg=manual).
- type: str
- domain_manual:
- description:
- - Domain Settings. Select whether the domain interface will be configured manually or automatically.
- choices: ['manual', 'auto']
- type: str
- domain_iface:
- description:
- - Network Interface, input like 'eth0_v4', 'eth0_v6', 'eth1_v4', 'eth1_v6', 'bond0_v4', 'bond0_v6'.
- - Required when I(domain_manual=auto).
- type: str
- domain_name:
- description:
- - Domain Name.
- - Required when I(domain_manual=manual).
- type: str
- dns_manual:
- description:
- - DNS Settings. Select whether the DNS interface will be configured manually or automatically.
- choices: ['manual', 'auto']
- type: str
- dns_iface:
- description:
- - DNS Interface, input like 'eth0', 'eth1', 'bond0'.
- - Required when I(dns_manual=auto).
- type: str
- dns_priority:
- description:
- - IP Priority.
- - Required when I(dns_manual=auto).
- choices: ['4', '6']
- type: str
- dns_server1:
- description:
- - DNS Server1 IPv4 or IPv6 address.
- - Required when I(dns_manual=manual).
- type: str
- dns_server2:
- description:
- - DNS Server2 IPv4 or IPv6 address.
- - Required when I(dns_manual=manual).
- type: str
- dns_server3:
- description:
- - DNS Server3 IPv4 or IPv6 address.
- - Required when I(dns_manual=manual).
- type: str
- register_status1:
- description:
- - BMC register status 1.
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- registration_method1:
- description:
- - Registration method 1.
- - Only the M6 model supports this parameter.
- - Required when I(register_status1=enable).
- choices: ['nsupdate', 'dhcp', 'hostname']
- type: str
- register_status2:
- description:
- - BMC register status 2.
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- registration_method2:
- description:
- - Registration method 2.
- - Only the M6 model supports this parameter.
- - Required when I(register_status2=enable).
- choices: ['nsupdate', 'dhcp', 'hostname']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: DNS test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set dns information"
- kaytus.ksmanage.edit_dns:
- dns_status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set dns information"
- kaytus.ksmanage.edit_dns:
- dns_status: "enable"
- host_cfg: "manual"
- host_name: "123456789"
- domain_manual: "auto"
- domain_iface: "eth0_v4"
- dns_manual: "manual"
- dns_server1: "100.2.2.2"
- dns_server2: "100.2.2.3"
- dns_server3: "100.2.2.4"
- provider: "{{ ksmanage }}"
-
- - name: "Set dns information"
- kaytus.ksmanage.edit_dns:
- dns_status: "enable"
- host_cfg: "manual"
- host_name: "123456789"
- domain_manual: "manual"
- domain_name: "test.com"
- dns_manual: "auto"
- dns_iface: "eth0"
- dns_priority: "4"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class DNS(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setdns'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- dns_status=dict(type='str', required=False, choices=['enable', 'disable']),
- host_cfg=dict(type='str', required=False, choices=['manual', 'auto']),
- host_name=dict(type='str', required=False),
- domain_manual=dict(type='str', required=False, choices=['manual', 'auto']),
- domain_iface=dict(type='str', required=False),
- domain_name=dict(type='str', required=False),
- dns_manual=dict(type='str', required=False, choices=['manual', 'auto']),
- dns_iface=dict(type='str', required=False),
- dns_priority=dict(type='str', required=False, choices=['4', '6']),
- dns_server1=dict(type='str', required=False),
- dns_server2=dict(type='str', required=False),
- dns_server3=dict(type='str', required=False),
- register_status1=dict(type='str', required=False, choices=['enable', 'disable']),
- registration_method1=dict(type='str', required=False, choices=['nsupdate', 'dhcp', 'hostname']),
- register_status2=dict(type='str', required=False, choices=['enable', 'disable']),
- registration_method2=dict(type='str', required=False, choices=['nsupdate', 'dhcp', 'hostname']),
- )
- argument_spec.update(ksmanage_argument_spec)
- dns_obj = DNS(argument_spec)
- dns_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_dns +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set dns information +description: + - Set dns information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + dns_status: + description: + - DNS status. + choices: ['enable', 'disable'] + type: str + host_cfg: + description: + - Host Settings. Select whether the host name will be configured manually or automatically. + choices: ['manual', 'auto'] + type: str + host_name: + description: + - Host Name. + - Required when I(host_cfg=manual). + type: str + domain_manual: + description: + - Domain Settings. Select whether the domain interface will be configured manually or automatically. + choices: ['manual', 'auto'] + type: str + domain_iface: + description: + - Network Interface, input like 'eth0_v4', 'eth0_v6', 'eth1_v4', 'eth1_v6', 'bond0_v4', 'bond0_v6'. + - Required when I(domain_manual=auto). + type: str + domain_name: + description: + - Domain Name. + - Required when I(domain_manual=manual). + type: str + dns_manual: + description: + - DNS Settings. Select whether the DNS interface will be configured manually or automatically. + choices: ['manual', 'auto'] + type: str + dns_iface: + description: + - DNS Interface, input like 'eth0', 'eth1', 'bond0'. + - Required when I(dns_manual=auto). + type: str + dns_priority: + description: + - IP Priority. + - Required when I(dns_manual=auto). + choices: ['4', '6'] + type: str + dns_server1: + description: + - DNS Server1 IPv4 or IPv6 address. + - Required when I(dns_manual=manual). + type: str + dns_server2: + description: + - DNS Server2 IPv4 or IPv6 address. + - Required when I(dns_manual=manual). + type: str + dns_server3: + description: + - DNS Server3 IPv4 or IPv6 address. + - Required when I(dns_manual=manual). + type: str + register_status1: + description: + - BMC register status 1. + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + registration_method1: + description: + - Registration method 1. + - Only the M6 model supports this parameter. + - Required when I(register_status1=enable). + choices: ['nsupdate', 'dhcp', 'hostname'] + type: str + register_status2: + description: + - BMC register status 2. + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + registration_method2: + description: + - Registration method 2. + - Only the M6 model supports this parameter. + - Required when I(register_status2=enable). + choices: ['nsupdate', 'dhcp', 'hostname'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: DNS test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set dns information" + kaytus.ksmanage.edit_dns: + dns_status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set dns information" + kaytus.ksmanage.edit_dns: + dns_status: "enable" + host_cfg: "manual" + host_name: "123456789" + domain_manual: "auto" + domain_iface: "eth0_v4" + dns_manual: "manual" + dns_server1: "100.2.2.2" + dns_server2: "100.2.2.3" + dns_server3: "100.2.2.4" + provider: "{{ ksmanage }}" + + - name: "Set dns information" + kaytus.ksmanage.edit_dns: + dns_status: "enable" + host_cfg: "manual" + host_name: "123456789" + domain_manual: "manual" + domain_name: "test.com" + dns_manual: "auto" + dns_iface: "eth0" + dns_priority: "4" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class DNS(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setdns' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + dns_status=dict(type='str', required=False, choices=['enable', 'disable']), + host_cfg=dict(type='str', required=False, choices=['manual', 'auto']), + host_name=dict(type='str', required=False), + domain_manual=dict(type='str', required=False, choices=['manual', 'auto']), + domain_iface=dict(type='str', required=False), + domain_name=dict(type='str', required=False), + dns_manual=dict(type='str', required=False, choices=['manual', 'auto']), + dns_iface=dict(type='str', required=False), + dns_priority=dict(type='str', required=False, choices=['4', '6']), + dns_server1=dict(type='str', required=False), + dns_server2=dict(type='str', required=False), + dns_server3=dict(type='str', required=False), + register_status1=dict(type='str', required=False, choices=['enable', 'disable']), + registration_method1=dict(type='str', required=False, choices=['nsupdate', 'dhcp', 'hostname']), + register_status2=dict(type='str', required=False, choices=['enable', 'disable']), + registration_method2=dict(type='str', required=False, choices=['nsupdate', 'dhcp', 'hostname']), + ) + argument_spec.update(ksmanage_argument_spec) + dns_obj = DNS(argument_spec) + dns_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_event_log_policy.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_event_log_policy.py index 39d46e9e1..52670a621 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_event_log_policy.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_event_log_policy.py @@ -1,110 +1,110 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_event_log_policy
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set event log policy
-description:
- - Set event log policy on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- policy:
- description:
- - Event log policy.
- choices: ['Linear', 'Circular']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Event log policy test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set event log policy"
- kaytus.ksmanage.edit_event_log_policy:
- policy: "Linear"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Log(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'seteventlogpolicy'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- policy=dict(type='str', required=True, choices=['Linear', 'Circular']),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = Log(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_event_log_policy +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set event log policy +description: + - Set event log policy on kaytus Server. +notes: + - Does not support C(check_mode). +options: + policy: + description: + - Event log policy. + choices: ['Linear', 'Circular'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Event log policy test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set event log policy" + kaytus.ksmanage.edit_event_log_policy: + policy: "Linear" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Log(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'seteventlogpolicy' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + policy=dict(type='str', required=True, choices=['Linear', 'Circular']), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = Log(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fan.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fan.py index e89d74d9b..c74c32845 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fan.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fan.py @@ -1,126 +1,126 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_fan
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set fan information
-description:
- - Set fan information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- mode:
- description:
- - Control mode, Manual or Automatic , Manual must be used with fans_peed.
- choices: ['Automatic', 'Manual']
- type: str
- id:
- description:
- - Fan id 255 is for all fans, 0~n.
- type: int
- fan_speed:
- description:
- - Fan speed (duty ratio), range in 1 - 100.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Fan test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set fan information"
- kaytus.ksmanage.edit_fan:
- mode: "Automatic"
- provider: "{{ ksmanage }}"
-
- - name: "Set fan information"
- kaytus.ksmanage.edit_fan:
- mode: "Manual"
- id: 1
- fan_speed: 80
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Fan(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'fancontrol'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- mode=dict(type='str', required=False, choices=['Automatic', 'Manual']),
- id=dict(type='int', required=False),
- fan_speed=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- fan_obj = Fan(argument_spec)
- fan_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_fan +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set fan information +description: + - Set fan information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + mode: + description: + - Control mode, Manual or Automatic , Manual must be used with fans_peed. + choices: ['Automatic', 'Manual'] + type: str + id: + description: + - Fan id 255 is for all fans, 0~n. + type: int + fan_speed: + description: + - Fan speed (duty ratio), range in 1 - 100. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Fan test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set fan information" + kaytus.ksmanage.edit_fan: + mode: "Automatic" + provider: "{{ ksmanage }}" + + - name: "Set fan information" + kaytus.ksmanage.edit_fan: + mode: "Manual" + id: 1 + fan_speed: 80 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Fan(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'fancontrol' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + mode=dict(type='str', required=False, choices=['Automatic', 'Manual']), + id=dict(type='int', required=False), + fan_speed=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + fan_obj = Fan(argument_spec) + fan_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fru.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fru.py index 4106a527f..404e96cc9 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fru.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_fru.py @@ -1,121 +1,121 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_fru
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set fru settings
-description:
- - Set fru settings on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- attribute:
- description:
- - CP is Chassis Part Number, CS is Chassis Serial, PM is Product Manufacturer.
- - PPN is Product Part Number, PS is Product Serial, PN is Product Name.
- - PV is Product Version, PAT is Product Asset Tag, BM is Board Mfg, BPN is Board Product Name.
- - BS is Board Serial, BP is Board Part Number.
- choices: ['CP', 'CS', 'PM', 'PPN', 'PS', 'PN', 'PV', 'PAT', 'BM', 'BPN', 'BS', 'BP']
- required: true
- type: str
- value:
- description:
- - Set the value of attribute.
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Fru test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set Fru"
- kaytus.ksmanage.edit_fru:
- attribute: "CP"
- value: "test"
- provider: "{{ ksmanage }}"
-
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class UID(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setfru'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- attribute=dict(type='str', required=True, choices=['CP', 'CS', 'PM', 'PPN', 'PS', 'PN', 'PV', 'PAT', 'BM', 'BPN', 'BS', 'BP']),
- value=dict(type='str', required=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- uid_obj = UID(argument_spec)
- uid_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_fru +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set fru settings +description: + - Set fru settings on kaytus Server. +notes: + - Does not support C(check_mode). +options: + attribute: + description: + - CP is Chassis Part Number, CS is Chassis Serial, PM is Product Manufacturer. + - PPN is Product Part Number, PS is Product Serial, PN is Product Name. + - PV is Product Version, PAT is Product Asset Tag, BM is Board Mfg, BPN is Board Product Name. + - BS is Board Serial, BP is Board Part Number. + choices: ['CP', 'CS', 'PM', 'PPN', 'PS', 'PN', 'PV', 'PAT', 'BM', 'BPN', 'BS', 'BP'] + required: true + type: str + value: + description: + - Set the value of attribute. + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Fru test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set Fru" + kaytus.ksmanage.edit_fru: + attribute: "CP" + value: "test" + provider: "{{ ksmanage }}" + +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class UID(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setfru' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + attribute=dict(type='str', required=True, choices=['CP', 'CS', 'PM', 'PPN', 'PS', 'PN', 'PV', 'PAT', 'BM', 'BPN', 'BS', 'BP']), + value=dict(type='str', required=True), + ) + argument_spec.update(ksmanage_argument_spec) + uid_obj = UID(argument_spec) + uid_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv4.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv4.py index 9eb55397b..09ed0d2b7 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv4.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv4.py @@ -1,159 +1,159 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ipv4
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set ipv4 information
-description:
- - Set ipv4 information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- interface_name:
- description:
- - Set interface name. Select the LAN interface to be configured.
- choices: ['eth0', 'eth1', 'bond0']
- required: true
- type: str
- ipv4_status:
- description:
- - Enable or disable IPV4.
- choices: ['enable', 'disable']
- type: str
- ipv4_dhcp_enable:
- description:
- - Enable 'Enable DHCP' to dynamically configure IPv4 address using Dynamic Host Configuration Protocol (DHCP).
- choices: ['dhcp', 'static']
- type: str
- ipv4_address:
- description:
- - If DHCP is disabled, specify a static IPv4 address to be configured for the selected interface.
- - Required when I(ipv4_dhcp_enable=static).
- type: str
- ipv4_subnet:
- description:
- - If DHCP is disabled, specify a static Subnet Mask to be configured for the selected interface.
- - Required when I(ipv4_dhcp_enable=static).
- type: str
- ipv4_gateway:
- description:
- - If DHCP is disabled, specify a static Default Gateway to be configured for the selected interface.
- - Required when I(ipv4_dhcp_enable=static).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ipv4 test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set ipv4 information"
- kaytus.ksmanage.edit_ipv4:
- interface_name: "eth0"
- ipv4_status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set ipv4 information"
- kaytus.ksmanage.edit_ipv4:
- interface_name: "eth0"
- ipv4_status: "enable"
- ipv4_dhcp_enable: "dhcp"
- provider: "{{ ksmanage }}"
-
- - name: "Set ipv4 information"
- kaytus.ksmanage.edit_ipv4:
- interface_name: "eth0"
- ipv4_status: "enable"
- ipv4_dhcp_enable: "static"
- ipv4_address: "100.2.36.10"
- ipv4_subnet: "255.255.255.0"
- ipv4_gateway: "100.2.36.1"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Network(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setipv4'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']),
- ipv4_status=dict(type='str', required=False, choices=['enable', 'disable']),
- ipv4_dhcp_enable=dict(type='str', required=False, choices=['dhcp', 'static']),
- ipv4_address=dict(type='str', required=False),
- ipv4_subnet=dict(type='str', required=False),
- ipv4_gateway=dict(type='str', required=False),
-
- )
- argument_spec.update(ksmanage_argument_spec)
- net_obj = Network(argument_spec)
- net_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ipv4 +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set ipv4 information +description: + - Set ipv4 information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + interface_name: + description: + - Set interface name. Select the LAN interface to be configured. + choices: ['eth0', 'eth1', 'bond0'] + required: true + type: str + ipv4_status: + description: + - Enable or disable IPV4. + choices: ['enable', 'disable'] + type: str + ipv4_dhcp_enable: + description: + - Enable 'Enable DHCP' to dynamically configure IPv4 address using Dynamic Host Configuration Protocol (DHCP). + choices: ['dhcp', 'static'] + type: str + ipv4_address: + description: + - If DHCP is disabled, specify a static IPv4 address to be configured for the selected interface. + - Required when I(ipv4_dhcp_enable=static). + type: str + ipv4_subnet: + description: + - If DHCP is disabled, specify a static Subnet Mask to be configured for the selected interface. + - Required when I(ipv4_dhcp_enable=static). + type: str + ipv4_gateway: + description: + - If DHCP is disabled, specify a static Default Gateway to be configured for the selected interface. + - Required when I(ipv4_dhcp_enable=static). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ipv4 test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set ipv4 information" + kaytus.ksmanage.edit_ipv4: + interface_name: "eth0" + ipv4_status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set ipv4 information" + kaytus.ksmanage.edit_ipv4: + interface_name: "eth0" + ipv4_status: "enable" + ipv4_dhcp_enable: "dhcp" + provider: "{{ ksmanage }}" + + - name: "Set ipv4 information" + kaytus.ksmanage.edit_ipv4: + interface_name: "eth0" + ipv4_status: "enable" + ipv4_dhcp_enable: "static" + ipv4_address: "100.2.36.10" + ipv4_subnet: "255.255.255.0" + ipv4_gateway: "100.2.36.1" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Network(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setipv4' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']), + ipv4_status=dict(type='str', required=False, choices=['enable', 'disable']), + ipv4_dhcp_enable=dict(type='str', required=False, choices=['dhcp', 'static']), + ipv4_address=dict(type='str', required=False), + ipv4_subnet=dict(type='str', required=False), + ipv4_gateway=dict(type='str', required=False), + + ) + argument_spec.update(ksmanage_argument_spec) + net_obj = Network(argument_spec) + net_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv6.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv6.py index 41cf9db73..50fcfca68 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv6.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ipv6.py @@ -1,166 +1,166 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ipv6
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set ipv6 information
-description:
- - Set ipv6 information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- interface_name:
- description:
- - Set interface name. Select the LAN interface to be configured.
- choices: ['eth0', 'eth1', 'bond0']
- required: True
- type: str
- ipv6_status:
- description:
- - Enable or disable IPV6.
- choices: ['enable', 'disable']
- type: str
- ipv6_dhcp_enable:
- description:
- - Enable 'Enable DHCP' to dynamically configure IPv6 address using Dynamic Host Configuration Protocol (DHCP).
- choices: ['dhcp', 'static']
- type: str
- ipv6_address:
- description:
- - If DHCP is disabled, specify a static IPv6 address to be configured for the selected interface.
- - Required when I(ipv6_dhcp_enable=static).
- type: str
- ipv6_index:
- description:
- - Ipv6 index(0-15).
- - Required when I(ipv6_dhcp_enable=static).
- type: int
- ipv6_prefix:
- description:
- - The subnet prefix length for the IPv6 settings(0-128).
- - Required when I(ipv6_dhcp_enable=static).
- type: int
- ipv6_gateway:
- description:
- - If DHCP is disabled, specify a static Default Gateway to be configured for the selected interface.
- - Required when I(ipv6_dhcp_enable=static).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ipv6 test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set ipv6 information"
- kaytus.ksmanage.edit_ipv6:
- interface_name: "eth0"
- ipv6_status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set ipv6 information"
- kaytus.ksmanage.edit_ipv6:
- interface_name: "eth0"
- ipv6_status: "enable"
- ipv6_dhcp_enable: "dhcp"
- provider: "{{ ksmanage }}"
-
- - name: "Set ipv6 information"
- kaytus.ksmanage.edit_ipv6:
- interface_name: "eth0"
- ipv6_status: "enable"
- ipv6_dhcp_enable: "static"
- ipv6_address: "::ffff:100:2:36:10"
- ipv6_index: 12
- ipv6_prefix: 16
- ipv6_gateway: "::"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Network(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setipv6'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']),
- ipv6_status=dict(type='str', required=False, choices=['enable', 'disable']),
- ipv6_dhcp_enable=dict(type='str', required=False, choices=['dhcp', 'static']),
- ipv6_address=dict(type='str', required=False),
- ipv6_index=dict(type='int', required=False),
- ipv6_prefix=dict(type='int', required=False),
- ipv6_gateway=dict(type='str', required=False),
-
- )
- argument_spec.update(ksmanage_argument_spec)
- net_obj = Network(argument_spec)
- net_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ipv6 +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set ipv6 information +description: + - Set ipv6 information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + interface_name: + description: + - Set interface name. Select the LAN interface to be configured. + choices: ['eth0', 'eth1', 'bond0'] + required: True + type: str + ipv6_status: + description: + - Enable or disable IPV6. + choices: ['enable', 'disable'] + type: str + ipv6_dhcp_enable: + description: + - Enable 'Enable DHCP' to dynamically configure IPv6 address using Dynamic Host Configuration Protocol (DHCP). + choices: ['dhcp', 'static'] + type: str + ipv6_address: + description: + - If DHCP is disabled, specify a static IPv6 address to be configured for the selected interface. + - Required when I(ipv6_dhcp_enable=static). + type: str + ipv6_index: + description: + - Ipv6 index(0-15). + - Required when I(ipv6_dhcp_enable=static). + type: int + ipv6_prefix: + description: + - The subnet prefix length for the IPv6 settings(0-128). + - Required when I(ipv6_dhcp_enable=static). + type: int + ipv6_gateway: + description: + - If DHCP is disabled, specify a static Default Gateway to be configured for the selected interface. + - Required when I(ipv6_dhcp_enable=static). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ipv6 test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set ipv6 information" + kaytus.ksmanage.edit_ipv6: + interface_name: "eth0" + ipv6_status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set ipv6 information" + kaytus.ksmanage.edit_ipv6: + interface_name: "eth0" + ipv6_status: "enable" + ipv6_dhcp_enable: "dhcp" + provider: "{{ ksmanage }}" + + - name: "Set ipv6 information" + kaytus.ksmanage.edit_ipv6: + interface_name: "eth0" + ipv6_status: "enable" + ipv6_dhcp_enable: "static" + ipv6_address: "::ffff:100:2:36:10" + ipv6_index: 12 + ipv6_prefix: 16 + ipv6_gateway: "::" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Network(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setipv6' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']), + ipv6_status=dict(type='str', required=False, choices=['enable', 'disable']), + ipv6_dhcp_enable=dict(type='str', required=False, choices=['dhcp', 'static']), + ipv6_address=dict(type='str', required=False), + ipv6_index=dict(type='int', required=False), + ipv6_prefix=dict(type='int', required=False), + ipv6_gateway=dict(type='str', required=False), + + ) + argument_spec.update(ksmanage_argument_spec) + net_obj = Network(argument_spec) + net_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_kvm.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_kvm.py index 24edb1d13..25304160a 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_kvm.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_kvm.py @@ -1,191 +1,191 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_kvm
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set KVM
-description:
- - Set KVM on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- client_type:
- description:
- - Client Type.
- - Only the M6 model supports this parameter.
- choices: ['vnc', 'viewer']
- type: str
- kvm_encryption:
- description:
- - Encrypt KVM packets.
- choices: ['enable', 'disable']
- type: str
- media_attach:
- description:
- - Two types of VM attach mode are available.
- - Attach is Immediately attaches Virtual Media to the server upon bootup.
- - Auto is Attaches Virtual Media to the server only when a virtual media session is started.
- - Only the M5 model supports this parameter.
- choices: ['attach', 'auto']
- type: str
- keyboard_language:
- description:
- - Select the Keyboard Language.
- - AD is Auto Detect, DA is Danish, NL-BE is Dutch Belgium, NL-NL is Dutch Netherland.
- - GB is English UK , US is English US, FI is Finnish, FR-BE is French Belgium, FR is French France.
- - DE is German Germany, DE-CH is German Switzerland, IT is Italian, JP is Japanese.
- - NO is Norwegian, PT is Portuguese, ES is Spanish, SV is Swedish, TR_F is Turkish F, TR_Q is Turkish Q.
- choices: ['AD', 'DA', 'NL-BE', 'NL-NL', 'GB', 'US', 'FI', 'FR-BE', 'FR', 'DE', 'DE-CH', 'IT', 'JP', 'ON', 'PT', 'EC', 'SV', 'TR_F', 'TR_Q']
- type: str
- retry_count:
- description:
- - Number of times to be retried in case a KVM failure occurs.Retry count ranges from 1 to 20.
- - Only the M5 model supports this parameter.
- type: int
- retry_time_interval:
- description:
- - The Identification for retry time interval configuration (5-30) seconds.
- - Only the M5 model supports this parameter.
- type: int
- local_monitor_off:
- description:
- - Server Monitor OFF Feature Status.
- choices: ['enable', 'disable']
- type: str
- automatic_off:
- description:
- - Automatically OFF Server Monitor, When KVM Launches.
- choices: ['enable', 'disable']
- type: str
- non_secure:
- description:
- - Enable/disable Non Secure Connection Type.
- - Only the M6 model supports this parameter.
- - Required when I(client_type=vnc).
- choices: ['enable', 'disable']
- type: str
- ssh_vnc:
- description:
- - Enable/disable VNC over SSH in BMC.
- - Only the M6 model supports this parameter.
- - Required when I(client_type=vnc).
- choices: ['enable', 'disable']
- type: str
- stunnel_vnc:
- description:
- - Enable/disable VNC over Stunnel in BMC.
- - Only the M6 model supports this parameter.
- - Required when I(client_type=vnc).
- choices: ['enable', 'disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: KVM test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set KVM"
- kaytus.ksmanage.edit_kvm:
- kvm_encryption: "enable"
- media_attach: "auto"
- keyboard_language: "AD"
- retry_count: 13
- retry_time_interval: 10
- local_monitor_off: "enable"
- automatic_off: "enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class KVM(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setkvm'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- client_type=dict(type='str', required=False, choices=['vnc', 'viewer']),
- kvm_encryption=dict(type='str', required=False, choices=['enable', 'disable']),
- media_attach=dict(type='str', required=False, choices=['attach', 'auto']),
- keyboard_language=dict(type='str', required=False,
- choices=['AD', 'DA', 'NL-BE', 'NL-NL', 'GB', 'US', 'FI', 'FR-BE', 'FR',
- 'DE', 'DE-CH', 'IT', 'JP', 'ON', 'PT', 'EC', 'SV', 'TR_F', 'TR_Q']),
- retry_count=dict(type='int', required=False),
- retry_time_interval=dict(type='int', required=False),
- local_monitor_off=dict(type='str', required=False, choices=['enable', 'disable']),
- automatic_off=dict(type='str', required=False, choices=['enable', 'disable']),
- non_secure=dict(type='str', required=False, choices=['enable', 'disable']),
- ssh_vnc=dict(type='str', required=False, choices=['enable', 'disable']),
- stunnel_vnc=dict(type='str', required=False, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- kvm_obj = KVM(argument_spec)
- kvm_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_kvm +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set KVM +description: + - Set KVM on kaytus Server. +notes: + - Does not support C(check_mode). +options: + client_type: + description: + - Client Type. + - Only the M6 model supports this parameter. + choices: ['vnc', 'viewer'] + type: str + kvm_encryption: + description: + - Encrypt KVM packets. + choices: ['enable', 'disable'] + type: str + media_attach: + description: + - Two types of VM attach mode are available. + - Attach is Immediately attaches Virtual Media to the server upon bootup. + - Auto is Attaches Virtual Media to the server only when a virtual media session is started. + - Only the M5 model supports this parameter. + choices: ['attach', 'auto'] + type: str + keyboard_language: + description: + - Select the Keyboard Language. + - AD is Auto Detect, DA is Danish, NL-BE is Dutch Belgium, NL-NL is Dutch Netherland. + - GB is English UK , US is English US, FI is Finnish, FR-BE is French Belgium, FR is French France. + - DE is German Germany, DE-CH is German Switzerland, IT is Italian, JP is Japanese. + - NO is Norwegian, PT is Portuguese, ES is Spanish, SV is Swedish, TR_F is Turkish F, TR_Q is Turkish Q. + choices: ['AD', 'DA', 'NL-BE', 'NL-NL', 'GB', 'US', 'FI', 'FR-BE', 'FR', 'DE', 'DE-CH', 'IT', 'JP', 'ON', 'PT', 'EC', 'SV', 'TR_F', 'TR_Q'] + type: str + retry_count: + description: + - Number of times to be retried in case a KVM failure occurs.Retry count ranges from 1 to 20. + - Only the M5 model supports this parameter. + type: int + retry_time_interval: + description: + - The Identification for retry time interval configuration (5-30) seconds. + - Only the M5 model supports this parameter. + type: int + local_monitor_off: + description: + - Server Monitor OFF Feature Status. + choices: ['enable', 'disable'] + type: str + automatic_off: + description: + - Automatically OFF Server Monitor, When KVM Launches. + choices: ['enable', 'disable'] + type: str + non_secure: + description: + - Enable/disable Non Secure Connection Type. + - Only the M6 model supports this parameter. + - Required when I(client_type=vnc). + choices: ['enable', 'disable'] + type: str + ssh_vnc: + description: + - Enable/disable VNC over SSH in BMC. + - Only the M6 model supports this parameter. + - Required when I(client_type=vnc). + choices: ['enable', 'disable'] + type: str + stunnel_vnc: + description: + - Enable/disable VNC over Stunnel in BMC. + - Only the M6 model supports this parameter. + - Required when I(client_type=vnc). + choices: ['enable', 'disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: KVM test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set KVM" + kaytus.ksmanage.edit_kvm: + kvm_encryption: "enable" + media_attach: "auto" + keyboard_language: "AD" + retry_count: 13 + retry_time_interval: 10 + local_monitor_off: "enable" + automatic_off: "enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class KVM(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setkvm' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + client_type=dict(type='str', required=False, choices=['vnc', 'viewer']), + kvm_encryption=dict(type='str', required=False, choices=['enable', 'disable']), + media_attach=dict(type='str', required=False, choices=['attach', 'auto']), + keyboard_language=dict(type='str', required=False, + choices=['AD', 'DA', 'NL-BE', 'NL-NL', 'GB', 'US', 'FI', 'FR-BE', 'FR', + 'DE', 'DE-CH', 'IT', 'JP', 'ON', 'PT', 'EC', 'SV', 'TR_F', 'TR_Q']), + retry_count=dict(type='int', required=False), + retry_time_interval=dict(type='int', required=False), + local_monitor_off=dict(type='str', required=False, choices=['enable', 'disable']), + automatic_off=dict(type='str', required=False, choices=['enable', 'disable']), + non_secure=dict(type='str', required=False, choices=['enable', 'disable']), + ssh_vnc=dict(type='str', required=False, choices=['enable', 'disable']), + stunnel_vnc=dict(type='str', required=False, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + kvm_obj = KVM(argument_spec) + kvm_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldap.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldap.py index 5654ba1a1..8e1d81855 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldap.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldap.py @@ -1,193 +1,193 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ldap
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set ldap information
-description:
- - Set ldap information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- enable:
- description:
- - LDAP/E-Directory Authentication Status.
- choices: ['enable', 'disable']
- type: str
- encry:
- description:
- - Encryption Type.
- choices: ['no', 'SSL', 'StartTLS']
- type: str
- address:
- description:
- - Server Address.
- type: str
- server_port:
- description:
- - Server Port. Specify the LDAP/E-Directory Port.
- type: int
- dn:
- description:
- - Bind DN. The Bind DN is used in bind operations, which authenticates the client to the server.
- - Bind DN is a string of 4 to 64 alphanumeric characters.
- - It must start with an alphabetical character.
- - Special Symbols like dot(.), comma(, ), hyphen(-), underscore(_), equal-to(=) are allowed.
- type: str
- code:
- description:
- - Password. The Bind password is also used in the bind authentication operations between client and server.
- - Required when I(enable=enable).
- type: str
- base:
- description:
- - Search Base.
- - The Search Base allows the LDAP/E-Directory server to find which part of the external directory tree is to be searched.
- - This search base may be equivalent to the organization or the group of the external directory.
- - Search base is a string of 4 to 64 alphanumeric characters.
- - It must start with an alphabetical character.
- - Special Symbols like dot(.), comma(, ), hyphen(-), underscore(_), equal-to(=) are allowed.
- type: str
- attr:
- description:
- - Attribute of User Login.
- - The Attribute of User Login field indicates to the LDAP/E-Directory server which attribute should be used to identify the user.
- choices: ['cn', 'uid']
- type: str
- cn:
- description:
- - Common name type.
- - Required when I(encry=StartTLS).
- choices: ['ip', 'fqdn']
- type: str
- ca:
- description:
- - CA certificate file path.
- - Required when I(encry=StartTLS).
- type: str
- ce:
- description:
- - Certificate file path.
- - Required when I(encry=StartTLS).
- type: str
- pk:
- description:
- - Private Key file path.
- - Required when I(encry=StartTLS).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ldap test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set ldap information"
- kaytus.ksmanage.edit_ldap:
- enable: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set ldap information"
- kaytus.ksmanage.edit_ldap:
- enable: "enable"
- encry: "SSL"
- address: "100.2.2.2"
- server_port: 389
- dn: "cn=manager,ou=login,dc=domain,dc=com"
- code: "123456"
- base: "cn=manager"
- attr: "uid"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LDAP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setldap'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- enable=dict(type='str', required=False, choices=['enable', 'disable']),
- encry=dict(type='str', required=False, choices=['no', 'SSL', 'StartTLS']),
- address=dict(type='str', required=False),
- server_port=dict(type='int', required=False),
- dn=dict(type='str', required=False),
- code=dict(type='str', required=False),
- base=dict(type='str', required=False),
- attr=dict(type='str', required=False, choices=['cn', 'uid']),
- cn=dict(type='str', required=False, choices=['ip', 'fqdn']),
- ca=dict(type='str', required=False),
- ce=dict(type='str', required=False),
- pk=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- ldap_obj = LDAP(argument_spec)
- ldap_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ldap +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set ldap information +description: + - Set ldap information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + enable: + description: + - LDAP/E-Directory Authentication Status. + choices: ['enable', 'disable'] + type: str + encry: + description: + - Encryption Type. + choices: ['no', 'SSL', 'StartTLS'] + type: str + address: + description: + - Server Address. + type: str + server_port: + description: + - Server Port. Specify the LDAP/E-Directory Port. + type: int + dn: + description: + - Bind DN. The Bind DN is used in bind operations, which authenticates the client to the server. + - Bind DN is a string of 4 to 64 alphanumeric characters. + - It must start with an alphabetical character. + - Special Symbols like dot(.), comma(, ), hyphen(-), underscore(_), equal-to(=) are allowed. + type: str + code: + description: + - Password. The Bind password is also used in the bind authentication operations between client and server. + - Required when I(enable=enable). + type: str + base: + description: + - Search Base. + - The Search Base allows the LDAP/E-Directory server to find which part of the external directory tree is to be searched. + - This search base may be equivalent to the organization or the group of the external directory. + - Search base is a string of 4 to 64 alphanumeric characters. + - It must start with an alphabetical character. + - Special Symbols like dot(.), comma(, ), hyphen(-), underscore(_), equal-to(=) are allowed. + type: str + attr: + description: + - Attribute of User Login. + - The Attribute of User Login field indicates to the LDAP/E-Directory server which attribute should be used to identify the user. + choices: ['cn', 'uid'] + type: str + cn: + description: + - Common name type. + - Required when I(encry=StartTLS). + choices: ['ip', 'fqdn'] + type: str + ca: + description: + - CA certificate file path. + - Required when I(encry=StartTLS). + type: str + ce: + description: + - Certificate file path. + - Required when I(encry=StartTLS). + type: str + pk: + description: + - Private Key file path. + - Required when I(encry=StartTLS). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ldap test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set ldap information" + kaytus.ksmanage.edit_ldap: + enable: "disable" + provider: "{{ ksmanage }}" + + - name: "Set ldap information" + kaytus.ksmanage.edit_ldap: + enable: "enable" + encry: "SSL" + address: "100.2.2.2" + server_port: 389 + dn: "cn=manager,ou=login,dc=domain,dc=com" + code: "123456" + base: "cn=manager" + attr: "uid" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LDAP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setldap' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + enable=dict(type='str', required=False, choices=['enable', 'disable']), + encry=dict(type='str', required=False, choices=['no', 'SSL', 'StartTLS']), + address=dict(type='str', required=False), + server_port=dict(type='int', required=False), + dn=dict(type='str', required=False), + code=dict(type='str', required=False), + base=dict(type='str', required=False), + attr=dict(type='str', required=False, choices=['cn', 'uid']), + cn=dict(type='str', required=False, choices=['ip', 'fqdn']), + ca=dict(type='str', required=False), + ce=dict(type='str', required=False), + pk=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + ldap_obj = LDAP(argument_spec) + ldap_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldisk.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldisk.py index b264e8865..1a92ea234 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldisk.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ldisk.py @@ -1,131 +1,131 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ldisk
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set logical disk
-description:
- - Set logical disk on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- ctrl_id:
- description:
- - Raid controller ID.
- type: int
- ldisk_id:
- description:
- - Logical disk ID.
- type: int
- option:
- description:
- - Set operation options for a logical disk.
- - LOC is Locate Logical Drive, STL is Stop Locate LogicalDrive.
- - FI is Fast Initialization, SFI is Slow/Full Initialization.
- - SI is Stop Initialization, DEL is Delete LogicalDrive.
- choices: ['LOC', 'STL', 'FI', 'SFI', 'SI', 'DEL']
- type: str
- duration:
- description:
- - Duration range is 1-255, physical drive under PMC raid controller.
- - Required when I(option=LOC).
- - Only the M6 model supports this parameter.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Edit ldisk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Edit ldisk"
- kaytus.ksmanage.edit_ldisk:
- ctrl_id: 0
- ldisk_id: 1
- option: "LOC"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setldisk'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- ctrl_id=dict(type='int', required=False),
- ldisk_id=dict(type='int', required=False),
- option=dict(type='str', required=False, choices=['LOC', 'STL', 'FI', 'SFI', 'SI', 'DEL']),
- duration=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ldisk +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set logical disk +description: + - Set logical disk on kaytus Server. +notes: + - Does not support C(check_mode). +options: + ctrl_id: + description: + - Raid controller ID. + type: int + ldisk_id: + description: + - Logical disk ID. + type: int + option: + description: + - Set operation options for a logical disk. + - LOC is Locate Logical Drive, STL is Stop Locate LogicalDrive. + - FI is Fast Initialization, SFI is Slow/Full Initialization. + - SI is Stop Initialization, DEL is Delete LogicalDrive. + choices: ['LOC', 'STL', 'FI', 'SFI', 'SI', 'DEL'] + type: str + duration: + description: + - Duration range is 1-255, physical drive under PMC raid controller. + - Required when I(option=LOC). + - Only the M6 model supports this parameter. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Edit ldisk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Edit ldisk" + kaytus.ksmanage.edit_ldisk: + ctrl_id: 0 + ldisk_id: 1 + option: "LOC" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setldisk' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + ctrl_id=dict(type='int', required=False), + ldisk_id=dict(type='int', required=False), + option=dict(type='str', required=False, choices=['LOC', 'STL', 'FI', 'SFI', 'SI', 'DEL']), + duration=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_log_setting.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_log_setting.py index dfdc94058..c0a3851fd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_log_setting.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_log_setting.py @@ -1,164 +1,164 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_log_setting
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set bmc system and audit log setting
-description:
- - Set bmc system and audit log setting on kaytus Server.
- - Only the M5 models support this feature.
-notes:
- - Does not support C(check_mode).
-options:
- status:
- description:
- - System Log Status.
- choices: ['enable', 'disable']
- type: str
- type:
- description:
- - System log type.
- choices: ['local', 'remote', 'both']
- type: str
- file_size:
- description:
- - File Size(3-65535bytes), set when type is local(default 30000).
- type: int
- audit_status:
- description:
- - Audit Log Status.
- choices: ['enable', 'disable']
- type: str
- audit_type:
- description:
- - Audit log type.
- choices: ['local', 'remote', 'both']
- type: str
- rotate_count:
- description:
- - Rotate Count, set when type is local, 0-delete old files(default), 1-bak old files.
- choices: [0, 1]
- type: int
- server_addr:
- description:
- - Server Address, set when type is remote.
- type: str
- server_port:
- description:
- - Server Port(0-65535), set when type is remote.
- type: int
- protocol_type:
- description:
- - Protocol Type, set when type is remote.
- choices: ['UDP', 'TCP']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Edit log setting test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Edit bmc system log setting"
- kaytus.ksmanage.edit_log_setting:
- status: "enable"
- type: "both"
- provider: "{{ ksmanage }}"
-
- - name: "Edit bmc audit log setting"
- kaytus.ksmanage.edit_log_setting:
- audit_status: "enable"
- audit_type: "remote"
- server_addr: "100.2.126.11"
- server_port: "514"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LogSetting(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setbmclogsettings'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- status=dict(type='str', required=False, choices=['enable', 'disable']),
- type=dict(type='str', required=False, choices=['local', 'remote', 'both']),
- file_size=dict(type='int', required=False),
- audit_status=dict(type='str', required=False, choices=['enable', 'disable']),
- audit_type=dict(type='str', required=False, choices=['local', 'remote', 'both']),
- rotate_count=dict(type='int', required=False, choices=[0, 1]),
- server_addr=dict(type='str', required=False),
- server_port=dict(type='int', required=False),
- protocol_type=dict(type='str', required=False, choices=['UDP', 'TCP']),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = LogSetting(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_log_setting +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set bmc system and audit log setting +description: + - Set bmc system and audit log setting on kaytus Server. + - Only the M5 models support this feature. +notes: + - Does not support C(check_mode). +options: + status: + description: + - System Log Status. + choices: ['enable', 'disable'] + type: str + type: + description: + - System log type. + choices: ['local', 'remote', 'both'] + type: str + file_size: + description: + - File Size(3-65535bytes), set when type is local(default 30000). + type: int + audit_status: + description: + - Audit Log Status. + choices: ['enable', 'disable'] + type: str + audit_type: + description: + - Audit log type. + choices: ['local', 'remote', 'both'] + type: str + rotate_count: + description: + - Rotate Count, set when type is local, 0-delete old files(default), 1-bak old files. + choices: [0, 1] + type: int + server_addr: + description: + - Server Address, set when type is remote. + type: str + server_port: + description: + - Server Port(0-65535), set when type is remote. + type: int + protocol_type: + description: + - Protocol Type, set when type is remote. + choices: ['UDP', 'TCP'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Edit log setting test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Edit bmc system log setting" + kaytus.ksmanage.edit_log_setting: + status: "enable" + type: "both" + provider: "{{ ksmanage }}" + + - name: "Edit bmc audit log setting" + kaytus.ksmanage.edit_log_setting: + audit_status: "enable" + audit_type: "remote" + server_addr: "100.2.126.11" + server_port: "514" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LogSetting(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setbmclogsettings' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + status=dict(type='str', required=False, choices=['enable', 'disable']), + type=dict(type='str', required=False, choices=['local', 'remote', 'both']), + file_size=dict(type='int', required=False), + audit_status=dict(type='str', required=False, choices=['enable', 'disable']), + audit_type=dict(type='str', required=False, choices=['local', 'remote', 'both']), + rotate_count=dict(type='int', required=False, choices=[0, 1]), + server_addr=dict(type='str', required=False), + server_port=dict(type='int', required=False), + protocol_type=dict(type='str', required=False, choices=['UDP', 'TCP']), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = LogSetting(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_m6_log_setting.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_m6_log_setting.py index 219a7b3ed..5c6a72b5d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_m6_log_setting.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_m6_log_setting.py @@ -1,174 +1,174 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_m6_log_setting
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set bmc system and audit log setting
-description:
- - Set bmc system and audit log setting on kaytus Server.
- - Only the M6 models support this feature.
-notes:
- - Does not support C(check_mode).
-options:
- status:
- description:
- - System Log Status.
- choices: ['enable', 'disable']
- type: str
- host_tag:
- description:
- - System log host tag, set when I(status=enable).
- choices: ['HostName', 'SerialNum', 'AssertTag']
- type: str
- level:
- description:
- - Events Level, set when I(status=enable).
- choices: ['Critical', 'Warning', 'Info']
- type: str
- protocol_type:
- description:
- - Protocol Type, set when I(status=enable).
- choices: ['UDP', 'TCP']
- type: str
- server_id:
- description:
- - Syslog Server ID, set when I(status=enable).
- choices: [0, 1, 2, 3]
- type: int
- server_addr:
- description:
- - Server Address, set when server_id is not none.
- type: str
- server_port:
- description:
- - Server Address, set when server_id is not none.
- type: int
- log_type:
- description:
- - Remote Log Type, set when server_id is not none.
- choices: ['idl', 'audit', 'both']
- type: str
- test:
- description:
- - Test remote log settings, set when server_id is not none.
- default: False
- type: bool
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Edit log setting test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Edit bmc system log setting"
- kaytus.ksmanage.edit_m6_log_setting:
- status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Edit bmc audit log setting"
- kaytus.ksmanage.edit_m6_log_setting:
- status: "enable"
- host_tag: "HostName"
- level: "Info"
- protocol_type: "TCP"
- server_id: 0
- server_addr: "100.2.126.11"
- server_port: 514
- log_type: "both"
- provider: "{{ ksmanage }}"
-
- - name: "test bmc audit log"
- kaytus.ksmanage.edit_m6_log_setting:
- server_id: 0
- test: True
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LogSetting(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setbmclogcfg'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- status=dict(type='str', required=False, choices=['enable', 'disable']),
- host_tag=dict(type='str', required=False, choices=['HostName', 'SerialNum', 'AssertTag']),
- level=dict(type='str', required=False, choices=['Critical', 'Warning', 'Info']),
- protocol_type=dict(type='str', required=False, choices=['UDP', 'TCP']),
- server_id=dict(type='int', required=False, choices=[0, 1, 2, 3]),
- server_addr=dict(type='str', required=False),
- server_port=dict(type='int', required=False),
- log_type=dict(type='str', required=False, choices=['idl', 'audit', 'both']),
- test=dict(type='bool', required=False, default=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = LogSetting(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_m6_log_setting +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set bmc system and audit log setting +description: + - Set bmc system and audit log setting on kaytus Server. + - Only the M6 models support this feature. +notes: + - Does not support C(check_mode). +options: + status: + description: + - System Log Status. + choices: ['enable', 'disable'] + type: str + host_tag: + description: + - System log host tag, set when I(status=enable). + choices: ['HostName', 'SerialNum', 'AssertTag'] + type: str + level: + description: + - Events Level, set when I(status=enable). + choices: ['Critical', 'Warning', 'Info'] + type: str + protocol_type: + description: + - Protocol Type, set when I(status=enable). + choices: ['UDP', 'TCP'] + type: str + server_id: + description: + - Syslog Server ID, set when I(status=enable). + choices: [0, 1, 2, 3] + type: int + server_addr: + description: + - Server Address, set when server_id is not none. + type: str + server_port: + description: + - Server Address, set when server_id is not none. + type: int + log_type: + description: + - Remote Log Type, set when server_id is not none. + choices: ['idl', 'audit', 'both'] + type: str + test: + description: + - Test remote log settings, set when server_id is not none. + default: False + type: bool +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Edit log setting test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Edit bmc system log setting" + kaytus.ksmanage.edit_m6_log_setting: + status: "disable" + provider: "{{ ksmanage }}" + + - name: "Edit bmc audit log setting" + kaytus.ksmanage.edit_m6_log_setting: + status: "enable" + host_tag: "HostName" + level: "Info" + protocol_type: "TCP" + server_id: 0 + server_addr: "100.2.126.11" + server_port: 514 + log_type: "both" + provider: "{{ ksmanage }}" + + - name: "test bmc audit log" + kaytus.ksmanage.edit_m6_log_setting: + server_id: 0 + test: True + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LogSetting(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setbmclogcfg' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + status=dict(type='str', required=False, choices=['enable', 'disable']), + host_tag=dict(type='str', required=False, choices=['HostName', 'SerialNum', 'AssertTag']), + level=dict(type='str', required=False, choices=['Critical', 'Warning', 'Info']), + protocol_type=dict(type='str', required=False, choices=['UDP', 'TCP']), + server_id=dict(type='int', required=False, choices=[0, 1, 2, 3]), + server_addr=dict(type='str', required=False), + server_port=dict(type='int', required=False), + log_type=dict(type='str', required=False, choices=['idl', 'audit', 'both']), + test=dict(type='bool', required=False, default=False), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = LogSetting(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_manual_capture.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_manual_capture.py index aca81c38a..6f678c352 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_manual_capture.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_manual_capture.py @@ -1,110 +1,110 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_manual_capture
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set manual capture screen
-description:
- - Set manual capture screen on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- type:
- description:
- - Manual type.
- choices: ['capture', 'delete']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Screen test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set manual capture screen"
- kaytus.ksmanage.edit_manual_capture:
- type: "capture"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Screen(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'screenmanual'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- type=dict(type='str', required=True, choices=['capture', 'delete']),
- )
- argument_spec.update(ksmanage_argument_spec)
- screen_obj = Screen(argument_spec)
- screen_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_manual_capture +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set manual capture screen +description: + - Set manual capture screen on kaytus Server. +notes: + - Does not support C(check_mode). +options: + type: + description: + - Manual type. + choices: ['capture', 'delete'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Screen test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set manual capture screen" + kaytus.ksmanage.edit_manual_capture: + type: "capture" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Screen(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'screenmanual' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + type=dict(type='str', required=True, choices=['capture', 'delete']), + ) + argument_spec.update(ksmanage_argument_spec) + screen_obj = Screen(argument_spec) + screen_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_media_instance.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_media_instance.py index 0d92cfe9a..d71883ca9 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_media_instance.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_media_instance.py @@ -1,167 +1,167 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_media_instance
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set Virtual Media Instance
-description:
- - Set Virtual Media Instance on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- num_fd:
- description:
- - Select the number of floppy devices that support for Virtual Media redirection.
- choices: [0, 1, 2, 3, 4]
- type: int
- num_cd:
- description:
- - Select the number of CD/DVD devices that support for Virtual Media redirection.
- choices: [0, 1, 2, 3, 4]
- type: int
- num_hd:
- description:
- - Select the number of harddisk devices that support for Virtual Media redirection.
- choices: [0, 1, 2, 3, 4]
- type: int
- kvm_num_fd:
- description:
- - Select the number of Remote KVM floppy devices that support for Virtual Media redirection.
- choices: [0, 1, 2, 3, 4]
- type: int
- kvm_num_cd:
- description:
- - Select the number of Remote KVM CD/DVD devices that support for virtual Media redirection.
- - The max support number of html5 KVM is 2 and java KVM is 4.
- choices: [0, 1, 2, 3, 4]
- type: int
- kvm_num_hd:
- description:
- - Select the number of Remote KVM Hard disk devices to support for Virtual Media redirection.
- choices: [0, 1, 2, 3, 4]
- type: int
- sd_media:
- description:
- - Check this option to enable SD Media support in BMC.
- choices: ['Enable', 'Disable']
- type: str
- secure_channel:
- description:
- - Check this option to enable encrypt media recirection packets.
- - Only the M5/M6 model supports this parameter.
- choices: ['Enable', 'Disable']
- type: str
- power_save_mode:
- description:
- - Check this option to enable Power Save Mode in BMC.
- choices: ['Enable', 'Disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Media instance test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set media instance"
- kaytus.ksmanage.edit_media_instance:
- num_fd: 1
- num_cd: 1
- num_hd: 1
- kvm_num_fd: 1
- kvm_num_cd: 1
- kvm_num_hd: 1
- sd_media: "Enable"
- secure_channel: "Enable"
- power_save_mode: "Enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Instance(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setmediainstance'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- num_fd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- num_cd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- num_hd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- kvm_num_fd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- kvm_num_cd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- kvm_num_hd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- sd_media=dict(type='str', required=False, choices=['Enable', 'Disable']),
- secure_channel=dict(type='str', required=False, choices=['Enable', 'Disable']),
- power_save_mode=dict(type='str', required=False, choices=['Enable', 'Disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- instance_obj = Instance(argument_spec)
- instance_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_media_instance +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set Virtual Media Instance +description: + - Set Virtual Media Instance on kaytus Server. +notes: + - Does not support C(check_mode). +options: + num_fd: + description: + - Select the number of floppy devices that support for Virtual Media redirection. + choices: [0, 1, 2, 3, 4] + type: int + num_cd: + description: + - Select the number of CD/DVD devices that support for Virtual Media redirection. + choices: [0, 1, 2, 3, 4] + type: int + num_hd: + description: + - Select the number of harddisk devices that support for Virtual Media redirection. + choices: [0, 1, 2, 3, 4] + type: int + kvm_num_fd: + description: + - Select the number of Remote KVM floppy devices that support for Virtual Media redirection. + choices: [0, 1, 2, 3, 4] + type: int + kvm_num_cd: + description: + - Select the number of Remote KVM CD/DVD devices that support for virtual Media redirection. + - The max support number of html5 KVM is 2 and java KVM is 4. + choices: [0, 1, 2, 3, 4] + type: int + kvm_num_hd: + description: + - Select the number of Remote KVM Hard disk devices to support for Virtual Media redirection. + choices: [0, 1, 2, 3, 4] + type: int + sd_media: + description: + - Check this option to enable SD Media support in BMC. + choices: ['Enable', 'Disable'] + type: str + secure_channel: + description: + - Check this option to enable encrypt media recirection packets. + - Only the M5/M6 model supports this parameter. + choices: ['Enable', 'Disable'] + type: str + power_save_mode: + description: + - Check this option to enable Power Save Mode in BMC. + choices: ['Enable', 'Disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Media instance test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set media instance" + kaytus.ksmanage.edit_media_instance: + num_fd: 1 + num_cd: 1 + num_hd: 1 + kvm_num_fd: 1 + kvm_num_cd: 1 + kvm_num_hd: 1 + sd_media: "Enable" + secure_channel: "Enable" + power_save_mode: "Enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Instance(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setmediainstance' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + num_fd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + num_cd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + num_hd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + kvm_num_fd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + kvm_num_cd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + kvm_num_hd=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + sd_media=dict(type='str', required=False, choices=['Enable', 'Disable']), + secure_channel=dict(type='str', required=False, choices=['Enable', 'Disable']), + power_save_mode=dict(type='str', required=False, choices=['Enable', 'Disable']), + ) + argument_spec.update(ksmanage_argument_spec) + instance_obj = Instance(argument_spec) + instance_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ncsi.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ncsi.py index a78b6fea0..0b0f99a39 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ncsi.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ncsi.py @@ -1,133 +1,133 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ncsi
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set ncsi information
-description:
- - Set ncsi information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- nic_type:
- description:
- - Nic type.
- - Only NF3280A6 and NF3180A6 model supports C(Disable) Settings, but not support C(PHY) Settings.
- - M6 model only support C(OCP), C(OCP1), C(PCIE) settings.
- choices: ['PHY', 'OCP', 'OCP1', 'PCIE', 'auto', 'Disable']
- type: str
- mode:
- description:
- - NCSI mode, auto-Auto Failover, manual-Manual Switch.
- - Only M6 model supports C(Disable) Settings.
- choices: ['auto', 'manual', 'Disable']
- type: str
- interface_name:
- description:
- - Interface name, for example eth0.
- - Only the M5 model supports this parameter.
- type: str
- channel_number:
- description:
- - Channel number.
- choices: [0, 1, 2, 3]
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: NCSI test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set ncsi information"
- kaytus.ksmanage.edit_ncsi:
- mode: "manual"
- nic_type: "PCIE"
- interface_name: "eth0"
- channel_number: 1
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class NCSI(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setncsi'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- nic_type=dict(type='str', required=False, choices=['PHY', 'OCP', 'OCP1', 'PCIE', 'auto', 'Disable']),
- mode=dict(type='str', required=False, choices=['auto', 'manual', 'Disable']),
- interface_name=dict(type='str', required=False),
- channel_number=dict(type='int', required=False, choices=[0, 1, 2, 3]),
- )
- argument_spec.update(ksmanage_argument_spec)
- ncsi_obj = NCSI(argument_spec)
- ncsi_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ncsi +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set ncsi information +description: + - Set ncsi information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + nic_type: + description: + - Nic type. + - Only NF3280A6 and NF3180A6 model supports C(Disable) Settings, but not support C(PHY) Settings. + - M6 model only support C(OCP), C(OCP1), C(PCIE) settings. + choices: ['PHY', 'OCP', 'OCP1', 'PCIE', 'auto', 'Disable'] + type: str + mode: + description: + - NCSI mode, auto-Auto Failover, manual-Manual Switch. + - Only M6 model supports C(Disable) Settings. + choices: ['auto', 'manual', 'Disable'] + type: str + interface_name: + description: + - Interface name, for example eth0. + - Only the M5 model supports this parameter. + type: str + channel_number: + description: + - Channel number. + choices: [0, 1, 2, 3] + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: NCSI test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set ncsi information" + kaytus.ksmanage.edit_ncsi: + mode: "manual" + nic_type: "PCIE" + interface_name: "eth0" + channel_number: 1 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class NCSI(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setncsi' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + nic_type=dict(type='str', required=False, choices=['PHY', 'OCP', 'OCP1', 'PCIE', 'auto', 'Disable']), + mode=dict(type='str', required=False, choices=['auto', 'manual', 'Disable']), + interface_name=dict(type='str', required=False), + channel_number=dict(type='int', required=False, choices=[0, 1, 2, 3]), + ) + argument_spec.update(ksmanage_argument_spec) + ncsi_obj = NCSI(argument_spec) + ncsi_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network.py index c67b8c943..dc2cefdbd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network.py @@ -1,118 +1,118 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_network
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set network information
-description:
- - Set network information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- interface_name:
- description:
- - Set interface name. Select the LAN interface to be configured.
- choices: ['eth0', 'eth1', 'bond0']
- required: true
- type: str
- lan_enable:
- description:
- - Enable or disable this interface. If disable, you cannot use this interface any more.
- choices: ['enable', 'disable']
- required: true
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Network test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set network information"
- kaytus.ksmanage.edit_network:
- interface_name: "eth0"
- lan_enable: "enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Network(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setnetwork'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']),
- lan_enable=dict(type='str', required=True, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- net_obj = Network(argument_spec)
- net_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_network +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set network information +description: + - Set network information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + interface_name: + description: + - Set interface name. Select the LAN interface to be configured. + choices: ['eth0', 'eth1', 'bond0'] + required: true + type: str + lan_enable: + description: + - Enable or disable this interface. If disable, you cannot use this interface any more. + choices: ['enable', 'disable'] + required: true + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Network test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set network information" + kaytus.ksmanage.edit_network: + interface_name: "eth0" + lan_enable: "enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Network(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setnetwork' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']), + lan_enable=dict(type='str', required=True, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + net_obj = Network(argument_spec) + net_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_bond.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_bond.py index 418fc66e3..779c134f4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_bond.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_bond.py @@ -1,123 +1,123 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_network_bond
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set network bond
-description:
- - Set network bond on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- bond:
- description:
- - Network bond status, If VLAN is enabled for slave interfaces, then Bonding cannot be enabled.
- choices: ['enable', 'disable']
- type: str
- interface:
- description:
- - Interface name.
- choices: ['shared', 'dedicated', 'both']
- type: str
- auto_config:
- description:
- - Enable this option to configure the interfaces in service configuration automatically.
- choices: ['enable', 'disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bond test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set network bond"
- kaytus.ksmanage.edit_network_bond:
- bond: "enable"
- interface: "dedicated"
- auto_config: "enable"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Bond(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setnetworkbond'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- bond=dict(type='str', required=False, choices=['enable', 'disable']),
- interface=dict(type='str', required=False, choices=['shared', 'dedicated', 'both']),
- auto_config=dict(type='str', required=False, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- bond_obj = Bond(argument_spec)
- bond_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_network_bond +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set network bond +description: + - Set network bond on kaytus Server. +notes: + - Does not support C(check_mode). +options: + bond: + description: + - Network bond status, If VLAN is enabled for slave interfaces, then Bonding cannot be enabled. + choices: ['enable', 'disable'] + type: str + interface: + description: + - Interface name. + choices: ['shared', 'dedicated', 'both'] + type: str + auto_config: + description: + - Enable this option to configure the interfaces in service configuration automatically. + choices: ['enable', 'disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bond test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set network bond" + kaytus.ksmanage.edit_network_bond: + bond: "enable" + interface: "dedicated" + auto_config: "enable" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Bond(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setnetworkbond' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + bond=dict(type='str', required=False, choices=['enable', 'disable']), + interface=dict(type='str', required=False, choices=['shared', 'dedicated', 'both']), + auto_config=dict(type='str', required=False, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + bond_obj = Bond(argument_spec) + bond_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_link.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_link.py index 094cefa6c..839df92e0 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_link.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_network_link.py @@ -1,140 +1,140 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_network_link
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set network link
-description:
- - Set network link on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- interface:
- description:
- - Interface name.
- choices: ['shared', 'dedicated', 'both']
- type: str
- required: true
- auto_nego:
- description:
- - This option allows the device to perform auto-configuration.
- - To achieve the best mode of operation (speed and duplex) on the link.
- choices: ['enable', 'disable']
- type: str
- link_speed:
- description:
- - Link speed will list all the supported capabilities of the network interface. It can be 10/100 Mbps.
- - Required when I(auto_nego=disable).
- choices: [10, 100]
- type: int
- duplex_mode:
- description:
- - Select any one of the following Duplex Mode.
- - Required when I(auto_nego=disable).
- choices: ['HALF', 'FULL']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Link test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set network link"
- kaytus.ksmanage.edit_network_link:
- interface: "dedicated"
- auto_nego: "enable"
- provider: "{{ ksmanage }}"
-
- - name: "Set network link"
- kaytus.ksmanage.edit_network_link:
- interface: "dedicated"
- auto_nego: "disable"
- link_speed: 100
- duplex_mode: "FULL"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Link(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setnetworklink'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface=dict(type='str', required=True, choices=['shared', 'dedicated', 'both']),
- auto_nego=dict(type='str', required=False, choices=['enable', 'disable']),
- link_speed=dict(type='int', required=False, choices=[10, 100]),
- duplex_mode=dict(type='str', required=False, choices=['HALF', 'FULL']),
- )
- argument_spec.update(ksmanage_argument_spec)
- link_obj = Link(argument_spec)
- link_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_network_link +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set network link +description: + - Set network link on kaytus Server. +notes: + - Does not support C(check_mode). +options: + interface: + description: + - Interface name. + choices: ['shared', 'dedicated', 'both'] + type: str + required: true + auto_nego: + description: + - This option allows the device to perform auto-configuration. + - To achieve the best mode of operation (speed and duplex) on the link. + choices: ['enable', 'disable'] + type: str + link_speed: + description: + - Link speed will list all the supported capabilities of the network interface. It can be 10/100 Mbps. + - Required when I(auto_nego=disable). + choices: [10, 100] + type: int + duplex_mode: + description: + - Select any one of the following Duplex Mode. + - Required when I(auto_nego=disable). + choices: ['HALF', 'FULL'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Link test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set network link" + kaytus.ksmanage.edit_network_link: + interface: "dedicated" + auto_nego: "enable" + provider: "{{ ksmanage }}" + + - name: "Set network link" + kaytus.ksmanage.edit_network_link: + interface: "dedicated" + auto_nego: "disable" + link_speed: 100 + duplex_mode: "FULL" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Link(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setnetworklink' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface=dict(type='str', required=True, choices=['shared', 'dedicated', 'both']), + auto_nego=dict(type='str', required=False, choices=['enable', 'disable']), + link_speed=dict(type='int', required=False, choices=[10, 100]), + duplex_mode=dict(type='str', required=False, choices=['HALF', 'FULL']), + ) + argument_spec.update(ksmanage_argument_spec) + link_obj = Link(argument_spec) + link_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ntp.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ntp.py index 5ca241f0d..630e94fbe 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ntp.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ntp.py @@ -1,173 +1,173 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_ntp
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set NTP
-description:
- - Set NTP on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- auto_date:
- description:
- - Date auto synchronize.
- choices: ['enable', 'disable']
- type: str
- ntp_time:
- description:
- - NTP time(YYYYmmddHHMMSS).
- - Only the M5 model supports this parameter.
- type: str
- time_zone:
- description:
- - UTC time zone, chose from {-12, -11.5, -11, ... , 11, 11.5, 12}.
- type: str
- server1:
- description:
- - NTP Server1(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- server2:
- description:
- - NTP Server2(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- server3:
- description:
- - NTP Server3(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- server4:
- description:
- - NTP Server4(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- server5:
- description:
- - NTP Server5(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- server6:
- description:
- - NTP Server6(ipv4 or ipv6 or domain name), set when auto_date is enable.
- type: str
- syn_cycle:
- description:
- - NTP syn cycle(minute), sync cycle(5-1440).
- type: int
- max_variety:
- description:
- - NTP Maximum jump time(minute), max variety(1-60).
- - Only the M6 model supports this parameter.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: NTP test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set ntp"
- kaytus.ksmanage.edit_ntp:
- auto_date: "enable"
- server2: "time.nist.gov"
- provider: "{{ ksmanage }}"
-
- - name: "Set ntp"
- kaytus.ksmanage.edit_ntp:
- auto_date: "disable"
- ntp_time: "20200609083600"
- provider: "{{ ksmanage }}"
-
- - name: "set ntp"
- kaytus.ksmanage.edit_ntp:
- time_zone: "8"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class NTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'settime'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- auto_date=dict(type='str', required=False, choices=['enable', 'disable']),
- ntp_time=dict(type='str', required=False),
- time_zone=dict(type='str', required=False),
- server1=dict(type='str', required=False),
- server2=dict(type='str', required=False),
- server3=dict(type='str', required=False),
- server4=dict(type='str', required=False),
- server5=dict(type='str', required=False),
- server6=dict(type='str', required=False),
- syn_cycle=dict(type='int', required=False),
- max_variety=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- ntp_obj = NTP(argument_spec)
- ntp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_ntp +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set NTP +description: + - Set NTP on kaytus Server. +notes: + - Does not support C(check_mode). +options: + auto_date: + description: + - Date auto synchronize. + choices: ['enable', 'disable'] + type: str + ntp_time: + description: + - NTP time(YYYYmmddHHMMSS). + - Only the M5 model supports this parameter. + type: str + time_zone: + description: + - UTC time zone, chose from {-12, -11.5, -11, ... , 11, 11.5, 12}. + type: str + server1: + description: + - NTP Server1(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + server2: + description: + - NTP Server2(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + server3: + description: + - NTP Server3(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + server4: + description: + - NTP Server4(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + server5: + description: + - NTP Server5(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + server6: + description: + - NTP Server6(ipv4 or ipv6 or domain name), set when auto_date is enable. + type: str + syn_cycle: + description: + - NTP syn cycle(minute), sync cycle(5-1440). + type: int + max_variety: + description: + - NTP Maximum jump time(minute), max variety(1-60). + - Only the M6 model supports this parameter. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: NTP test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set ntp" + kaytus.ksmanage.edit_ntp: + auto_date: "enable" + server2: "time.nist.gov" + provider: "{{ ksmanage }}" + + - name: "Set ntp" + kaytus.ksmanage.edit_ntp: + auto_date: "disable" + ntp_time: "20200609083600" + provider: "{{ ksmanage }}" + + - name: "set ntp" + kaytus.ksmanage.edit_ntp: + time_zone: "8" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class NTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'settime' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + auto_date=dict(type='str', required=False, choices=['enable', 'disable']), + ntp_time=dict(type='str', required=False), + time_zone=dict(type='str', required=False), + server1=dict(type='str', required=False), + server2=dict(type='str', required=False), + server3=dict(type='str', required=False), + server4=dict(type='str', required=False), + server5=dict(type='str', required=False), + server6=dict(type='str', required=False), + syn_cycle=dict(type='int', required=False), + max_variety=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + ntp_obj = NTP(argument_spec) + ntp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_pdisk.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_pdisk.py index f9b347796..91f3951db 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_pdisk.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_pdisk.py @@ -1,178 +1,178 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_pdisk
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set physical disk
-description:
- - Set physical disk on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- ctrl_id:
- description:
- - Raid controller ID.
- type: int
- device_id:
- description:
- - Physical drive id.
- type: int
- option:
- description:
- - Set operation options for a physical disk.
- - UG is Unconfigured Good, UB is Unconfigured Bad.
- - OFF is offline, FAIL is Failed, RBD is Rebuild.
- - ON is Online, JB is JBOD, ES is Drive Erase stop.
- - EM is Drive Erase Simple, EN is Drive Erase Normal.
- - ET is Drive Erase Through, LOC is Locate, STL is Stop Locate.
- - HS is Hot spare.
- - Only the M5 model supports C(HS) Settings.
- choices: ['UG', 'UB', 'OFF', 'FAIL', 'RBD', 'ON', 'JB', 'ES', 'EM', 'EN', 'ET', 'LOC', 'STL', 'HS']
- type: str
- action:
- description:
- - Action while set physical drive hotspare.
- - Required when I(option=HS).
- - Only the M5 model supports this parameter.
- choices: ['remove', 'global', 'dedicate']
- type: str
- revertible:
- description:
- - IsRevertible while set physical drive hotspare.
- - Required when I(option=HS) and I(action=dedicate).
- - Only the M5 model supports this parameter.
- choices: ['yes', 'no']
- type: str
- encl:
- description:
- - IsEnclAffinity while set physical drive hotspare.
- - Required when I(option=HS) and I(action=dedicate).
- - Only the M5 model supports this parameter.
- choices: ['yes', 'no']
- type: str
- logical_drivers:
- description:
- - Logical Drivers while set physical drive hotspare, input multiple Logical Drivers index like 0, 1, 2.....
- - Required when I(option=HS) and I(action=dedicate).
- - Only the M5 model supports this parameter.
- type: list
- elements: int
- duration:
- description:
- - Duration range is 1-255, physical drive under PMC raid controller.
- - Required when I(option=LOC).
- - Only the M6 model supports this parameter.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Edit pdisk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Edit pdisk"
- kaytus.ksmanage.edit_pdisk:
- ctrl_id: 0
- device_id: 1
- option: "LOC"
- provider: "{{ ksmanage }}"
-
- - name: "M5 Edit pdisk"
- kaytus.ksmanage.edit_pdisk:
- ctrl_id: 0
- device_id: 1
- option: "HS"
- action: "dedicate"
- revertible: "yes"
- encl: "yes"
- logical_drivers: 1
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setpdisk'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- ctrl_id=dict(type='int', required=False),
- device_id=dict(type='int', required=False),
- option=dict(type='str', required=False, choices=['UG', 'UB', 'OFF', 'FAIL', 'RBD', 'ON', 'JB', 'ES', 'EM', 'EN', 'ET', 'LOC', 'STL', 'HS']),
- action=dict(type='str', required=False, choices=['remove', 'global', 'dedicate']),
- revertible=dict(type='str', required=False, choices=['yes', 'no']),
- encl=dict(type='str', required=False, choices=['yes', 'no']),
- logical_drivers=dict(type='list', elements='int', required=False),
- duration=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_pdisk +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set physical disk +description: + - Set physical disk on kaytus Server. +notes: + - Does not support C(check_mode). +options: + ctrl_id: + description: + - Raid controller ID. + type: int + device_id: + description: + - Physical drive id. + type: int + option: + description: + - Set operation options for a physical disk. + - UG is Unconfigured Good, UB is Unconfigured Bad. + - OFF is offline, FAIL is Failed, RBD is Rebuild. + - ON is Online, JB is JBOD, ES is Drive Erase stop. + - EM is Drive Erase Simple, EN is Drive Erase Normal. + - ET is Drive Erase Through, LOC is Locate, STL is Stop Locate. + - HS is Hot spare. + - Only the M5 model supports C(HS) Settings. + choices: ['UG', 'UB', 'OFF', 'FAIL', 'RBD', 'ON', 'JB', 'ES', 'EM', 'EN', 'ET', 'LOC', 'STL', 'HS'] + type: str + action: + description: + - Action while set physical drive hotspare. + - Required when I(option=HS). + - Only the M5 model supports this parameter. + choices: ['remove', 'global', 'dedicate'] + type: str + revertible: + description: + - IsRevertible while set physical drive hotspare. + - Required when I(option=HS) and I(action=dedicate). + - Only the M5 model supports this parameter. + choices: ['yes', 'no'] + type: str + encl: + description: + - IsEnclAffinity while set physical drive hotspare. + - Required when I(option=HS) and I(action=dedicate). + - Only the M5 model supports this parameter. + choices: ['yes', 'no'] + type: str + logical_drivers: + description: + - Logical Drivers while set physical drive hotspare, input multiple Logical Drivers index like 0, 1, 2..... + - Required when I(option=HS) and I(action=dedicate). + - Only the M5 model supports this parameter. + type: list + elements: int + duration: + description: + - Duration range is 1-255, physical drive under PMC raid controller. + - Required when I(option=LOC). + - Only the M6 model supports this parameter. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Edit pdisk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Edit pdisk" + kaytus.ksmanage.edit_pdisk: + ctrl_id: 0 + device_id: 1 + option: "LOC" + provider: "{{ ksmanage }}" + + - name: "M5 Edit pdisk" + kaytus.ksmanage.edit_pdisk: + ctrl_id: 0 + device_id: 1 + option: "HS" + action: "dedicate" + revertible: "yes" + encl: "yes" + logical_drivers: 1 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setpdisk' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + ctrl_id=dict(type='int', required=False), + device_id=dict(type='int', required=False), + option=dict(type='str', required=False, choices=['UG', 'UB', 'OFF', 'FAIL', 'RBD', 'ON', 'JB', 'ES', 'EM', 'EN', 'ET', 'LOC', 'STL', 'HS']), + action=dict(type='str', required=False, choices=['remove', 'global', 'dedicate']), + revertible=dict(type='str', required=False, choices=['yes', 'no']), + encl=dict(type='str', required=False, choices=['yes', 'no']), + logical_drivers=dict(type='list', elements='int', required=False), + duration=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_budget.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_budget.py index db75410dc..b36e979e9 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_budget.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_budget.py @@ -1,260 +1,260 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_power_budget
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set power budget information
-description:
- - Set power budget information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- range:
- description:
- - Range of power budget watts.
- choices: ['True', 'False']
- default: False
- type: bool
- domain:
- description:
- - Domain id.
- - Required when I(range=False).
- choices: ['system', 'cpu']
- type: str
- action:
- description:
- - Type to action.
- - Required when I(range=False).
- choices: ['add', 'delete', 'open', 'close']
- type: str
- id:
- description:
- - Policy id.
- - Required when I(range=False).
- choices: [1, 2, 3, 4]
- type: int
- watts:
- description:
- - Power budget watts of add.
- - Required when I(action=add).
- type: int
- except_action:
- description:
- - Except action, 0 is do nothing, 1 is send alert, 2 is shutdown system, 3 is shutdown system and send alert.
- - Only the M7 model supports this parameter.
- choices: [0, 1, 2, 3]
- type: int
- start1:
- description:
- - Pause period of add, start time, from 0 to 24.
- type: int
- end1:
- description:
- - Pause period of add, end time, must be greater than start time, from 0 to 24.
- type: int
- week1:
- description:
- - Pause period of add, repetition period.
- - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri.
- type: list
- elements: str
- start2:
- description:
- - Pause period of add, start time, from 0 to 24.
- type: int
- end2:
- description:
- - Pause period of add, end time, must be greater than start time, from 0 to 24.
- type: int
- week2:
- description:
- - Pause period of add, repetition period.
- - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri.
- type: list
- elements: str
- start3:
- description:
- - Pause period of add, start time, from 0 to 24.
- type: int
- end3:
- description:
- - Pause period of add, end time, must be greater than start time, from 0 to 24.
- type: int
- week3:
- description:
- - Pause period of add, repetition period.
- - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri.
- type: list
- elements: str
- start4:
- description:
- - Pause period of add, start time, from 0 to 24.
- type: int
- end4:
- description:
- - Pause period of add, end time, must be greater than start time, from 0 to 24.
- type: int
- week4:
- description:
- - Pause period of add, repetition period.
- - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri.
- type: list
- elements: str
- start5:
- description:
- - Period of add, start time, from 0 to 24.
- type: int
- end5:
- description:
- - Pause period of add, end time, must be greater than start time, from 0 to 24.
- type: int
- week5:
- description:
- - Pause period of add, repetition period.
- - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri.
- type: list
- elements: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power budget test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get power budget range"
- kaytus.ksmanage.edit_power_budget:
- range: True
- provider: "{{ ksmanage }}"
-
- - name: "add power budget"
- kaytus.ksmanage.edit_power_budget:
- action: "add"
- id: 1
- watts: 1500
- start1: 2
- end1: 5
- week1:
- - Mon
- - Wed
- - Fri
- provider: "{{ ksmanage }}"
-
- - name: "Set power budget status to open"
- kaytus.ksmanage.edit_power_budget:
- action: "open"
- id: 1
- provider: "{{ ksmanage }}"
-
- - name: "Set power budget status to close"
- kaytus.ksmanage.edit_power_budget:
- action: "close"
- id: 1
- provider: "{{ ksmanage }}"
-
- - name: "Delete power budget"
- kaytus.ksmanage.edit_power_budget:
- action: "delete"
- id: 1
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setpowerbudget'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- range=dict(type='bool', default=False, choices=[True, False]),
- domain=dict(type='str', required=False, choices=['system', 'cpu']),
- action=dict(type='str', required=False, choices=['add', 'delete', 'open', 'close']),
- id=dict(type='int', required=False, choices=[1, 2, 3, 4]),
- watts=dict(type='int', required=False),
- except_action=dict(type='int', required=False, choices=[0, 1, 2, 3]),
- start1=dict(type='int', required=False),
- end1=dict(type='int', required=False),
- week1=dict(type='list', elements='str', required=False),
- start2=dict(type='int', required=False),
- end2=dict(type='int', required=False),
- week2=dict(type='list', elements='str', required=False),
- start3=dict(type='int', required=False),
- end3=dict(type='int', required=False),
- week3=dict(type='list', elements='str', required=False),
- start4=dict(type='int', required=False),
- end4=dict(type='int', required=False),
- week4=dict(type='list', elements='str', required=False),
- start5=dict(type='int', required=False),
- end5=dict(type='int', required=False),
- week5=dict(type='list', elements='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_power_budget +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set power budget information +description: + - Set power budget information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + range: + description: + - Range of power budget watts. + choices: ['True', 'False'] + default: False + type: bool + domain: + description: + - Domain id. + - Required when I(range=False). + choices: ['system', 'cpu'] + type: str + action: + description: + - Type to action. + - Required when I(range=False). + choices: ['add', 'delete', 'open', 'close'] + type: str + id: + description: + - Policy id. + - Required when I(range=False). + choices: [1, 2, 3, 4] + type: int + watts: + description: + - Power budget watts of add. + - Required when I(action=add). + type: int + except_action: + description: + - Except action, 0 is do nothing, 1 is send alert, 2 is shutdown system, 3 is shutdown system and send alert. + - Only the M7 model supports this parameter. + choices: [0, 1, 2, 3] + type: int + start1: + description: + - Pause period of add, start time, from 0 to 24. + type: int + end1: + description: + - Pause period of add, end time, must be greater than start time, from 0 to 24. + type: int + week1: + description: + - Pause period of add, repetition period. + - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri. + type: list + elements: str + start2: + description: + - Pause period of add, start time, from 0 to 24. + type: int + end2: + description: + - Pause period of add, end time, must be greater than start time, from 0 to 24. + type: int + week2: + description: + - Pause period of add, repetition period. + - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri. + type: list + elements: str + start3: + description: + - Pause period of add, start time, from 0 to 24. + type: int + end3: + description: + - Pause period of add, end time, must be greater than start time, from 0 to 24. + type: int + week3: + description: + - Pause period of add, repetition period. + - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri. + type: list + elements: str + start4: + description: + - Pause period of add, start time, from 0 to 24. + type: int + end4: + description: + - Pause period of add, end time, must be greater than start time, from 0 to 24. + type: int + week4: + description: + - Pause period of add, repetition period. + - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri. + type: list + elements: str + start5: + description: + - Period of add, start time, from 0 to 24. + type: int + end5: + description: + - Pause period of add, end time, must be greater than start time, from 0 to 24. + type: int + week5: + description: + - Pause period of add, repetition period. + - The input parameters are 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun', separated by commas, such as Mon, Wed, Fri. + type: list + elements: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power budget test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get power budget range" + kaytus.ksmanage.edit_power_budget: + range: True + provider: "{{ ksmanage }}" + + - name: "add power budget" + kaytus.ksmanage.edit_power_budget: + action: "add" + id: 1 + watts: 1500 + start1: 2 + end1: 5 + week1: + - Mon + - Wed + - Fri + provider: "{{ ksmanage }}" + + - name: "Set power budget status to open" + kaytus.ksmanage.edit_power_budget: + action: "open" + id: 1 + provider: "{{ ksmanage }}" + + - name: "Set power budget status to close" + kaytus.ksmanage.edit_power_budget: + action: "close" + id: 1 + provider: "{{ ksmanage }}" + + - name: "Delete power budget" + kaytus.ksmanage.edit_power_budget: + action: "delete" + id: 1 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setpowerbudget' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + range=dict(type='bool', default=False, choices=[True, False]), + domain=dict(type='str', required=False, choices=['system', 'cpu']), + action=dict(type='str', required=False, choices=['add', 'delete', 'open', 'close']), + id=dict(type='int', required=False, choices=[1, 2, 3, 4]), + watts=dict(type='int', required=False), + except_action=dict(type='int', required=False, choices=[0, 1, 2, 3]), + start1=dict(type='int', required=False), + end1=dict(type='int', required=False), + week1=dict(type='list', elements='str', required=False), + start2=dict(type='int', required=False), + end2=dict(type='int', required=False), + week2=dict(type='list', elements='str', required=False), + start3=dict(type='int', required=False), + end3=dict(type='int', required=False), + week3=dict(type='list', elements='str', required=False), + start4=dict(type='int', required=False), + end4=dict(type='int', required=False), + week4=dict(type='list', elements='str', required=False), + start5=dict(type='int', required=False), + end5=dict(type='int', required=False), + week5=dict(type='list', elements='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_restore.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_restore.py index ec0fccc11..311c35cf4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_restore.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_restore.py @@ -1,110 +1,110 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_power_restore
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set power restore information
-description:
- - Set power restore information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- option:
- description:
- - Set power policy option.
- choices: ['on', 'off', 'restore']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power restore test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set power restore information"
- kaytus.ksmanage.edit_power_restore:
- option: "on"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setpowerrestore'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- option=dict(type='str', required=True, choices=['on', 'off', 'restore']),
- )
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_power_restore +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set power restore information +description: + - Set power restore information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + option: + description: + - Set power policy option. + choices: ['on', 'off', 'restore'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power restore test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set power restore information" + kaytus.ksmanage.edit_power_restore: + option: "on" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setpowerrestore' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + option=dict(type='str', required=True, choices=['on', 'off', 'restore']), + ) + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_status.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_status.py index 8c9350f2e..b9a4e93ca 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_status.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_power_status.py @@ -1,110 +1,110 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_power_status
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set power status information
-description:
- - Set power status information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- state:
- description:
- - Power status.
- choices: ['On', 'ForceOff', 'ForcePowerCycle', 'ForceReset', 'GracefulShutdown']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power status test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set power status information"
- kaytus.ksmanage.edit_power_status:
- state: "On"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'powercontrol'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- state=dict(type='str', required=True, choices=['On', 'ForceOff', 'ForcePowerCycle', 'ForceReset', 'GracefulShutdown']),
- )
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_power_status +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set power status information +description: + - Set power status information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + state: + description: + - Power status. + choices: ['On', 'ForceOff', 'ForcePowerCycle', 'ForceReset', 'GracefulShutdown'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power status test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set power status information" + kaytus.ksmanage.edit_power_status: + state: "On" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'powercontrol' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + state=dict(type='str', required=True, choices=['On', 'ForceOff', 'ForcePowerCycle', 'ForceReset', 'GracefulShutdown']), + ) + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_preserve_config.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_preserve_config.py index ef34c5829..22ff9f2cd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_preserve_config.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_preserve_config.py @@ -1,136 +1,136 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_preserve_config
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set preserve config
-description:
- - Set preserve config on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- setting:
- description:
- - Preserve option, all - preserve all config; none - overwrite all config; manual - manual choose.
- choices: ['all', 'none', 'manual']
- type: str
- required: true
- override:
- description:
- - Configuration items that need to be retained.
- - Required when I(setting=manual).
- choices: ['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', 'pef',
- 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']
- type: list
- elements: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Preserve test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set preserve all"
- kaytus.ksmanage.edit_preserve_config:
- setting: "all"
- provider: "{{ ksmanage }}"
-
- - name: "Set preserve none"
- edit_preserve_config:
- setting: "none"
- provider: "{{ ksmanage }}"
-
- - name: "Set preserve manual"
- edit_preserve_config:
- setting: "manual"
- override:
- - fru
- - ntp
- - network
- - user
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Preserve(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'preserveconfig'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- setting=dict(type='str', required=True, choices=['all', 'none', 'manual']),
- override=dict(type='list', elements='str', required=False,
- choices=['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp',
- 'pef', 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']),
- )
- argument_spec.update(ksmanage_argument_spec)
- pre_obj = Preserve(argument_spec)
- pre_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_preserve_config +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set preserve config +description: + - Set preserve config on kaytus Server. +notes: + - Does not support C(check_mode). +options: + setting: + description: + - Preserve option, all - preserve all config; none - overwrite all config; manual - manual choose. + choices: ['all', 'none', 'manual'] + type: str + required: true + override: + description: + - Configuration items that need to be retained. + - Required when I(setting=manual). + choices: ['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', 'pef', + 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user'] + type: list + elements: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Preserve test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set preserve all" + kaytus.ksmanage.edit_preserve_config: + setting: "all" + provider: "{{ ksmanage }}" + + - name: "Set preserve none" + edit_preserve_config: + setting: "none" + provider: "{{ ksmanage }}" + + - name: "Set preserve manual" + edit_preserve_config: + setting: "manual" + override: + - fru + - ntp + - network + - user + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Preserve(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'preserveconfig' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + setting=dict(type='str', required=True, choices=['all', 'none', 'manual']), + override=dict(type='list', elements='str', required=False, + choices=['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', + 'pef', 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']), + ) + argument_spec.update(ksmanage_argument_spec) + pre_obj = Preserve(argument_spec) + pre_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_config.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_config.py index eb11809ef..d4a66f86d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_config.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_config.py @@ -1,116 +1,116 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_psu_config
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set psu config information
-description:
- - Set psu config information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- id:
- description:
- - Power id.
- type: int
- required: true
- switch:
- description:
- - Power supply mode, active or standby.
- choices: ['active', 'standby', 'normal']
- type: str
- required: true
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Psu config test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set psu config information"
- kaytus.ksmanage.edit_psu_config:
- id: 1
- switch: "active"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Psu(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setpsuconfig'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- id=dict(type='int', required=True),
- switch=dict(type='str', required=True, choices=['active', 'standby', 'normal']),
- )
- argument_spec.update(ksmanage_argument_spec)
- psu_obj = Psu(argument_spec)
- psu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_psu_config +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set psu config information +description: + - Set psu config information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + id: + description: + - Power id. + type: int + required: true + switch: + description: + - Power supply mode, active or standby. + choices: ['active', 'standby', 'normal'] + type: str + required: true +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Psu config test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set psu config information" + kaytus.ksmanage.edit_psu_config: + id: 1 + switch: "active" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Psu(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setpsuconfig' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + id=dict(type='int', required=True), + switch=dict(type='str', required=True, choices=['active', 'standby', 'normal']), + ) + argument_spec.update(ksmanage_argument_spec) + psu_obj = Psu(argument_spec) + psu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_peak.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_peak.py index 3af211ea6..51f67e45b 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_peak.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_psu_peak.py @@ -1,121 +1,121 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_psu_peak
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set psu peak information
-description:
- - Set psu peak information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- status:
- description:
- - Power peak status.
- choices: ['enable', 'disable']
- type: str
- required: true
- time:
- description:
- - Maximum random time, range of values(1-600), unit(second).
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Psu peak test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set psu peak information"
- kaytus.ksmanage.edit_psu_peak:
- status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set psu peak information"
- kaytus.ksmanage.edit_psu_peak:
- status: "enable"
- time: 10
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Psu(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setpsupeak'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- status=dict(type='str', required=True, choices=['enable', 'disable']),
- time=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- psu_obj = Psu(argument_spec)
- psu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_psu_peak +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set psu peak information +description: + - Set psu peak information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + status: + description: + - Power peak status. + choices: ['enable', 'disable'] + type: str + required: true + time: + description: + - Maximum random time, range of values(1-600), unit(second). + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Psu peak test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set psu peak information" + kaytus.ksmanage.edit_psu_peak: + status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set psu peak information" + kaytus.ksmanage.edit_psu_peak: + status: "enable" + time: 10 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Psu(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setpsupeak' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + status=dict(type='str', required=True, choices=['enable', 'disable']), + time=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + psu_obj = Psu(argument_spec) + psu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_restore_factory_default.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_restore_factory_default.py index 6a8b2a34e..124ed128c 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_restore_factory_default.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_restore_factory_default.py @@ -1,131 +1,131 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_restore_factory_default
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set preserver config
-description:
- - Set preserver config on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- mode:
- description:
- - Restore factory defaults mode.
- choices: ['all', 'none', 'manual']
- type: str
- required: true
- override:
- description:
- - Configuration items that need to be retained.
- - Required when I(mode=manual).
- choices: ['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', 'pef',
- 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']
- type: list
- elements: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Restore default test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set restore default auto"
- kaytus.ksmanage.edit_restore_factory_default:
- mode: "all"
- provider: "{{ ksmanage }}"
-
- - name: "Set restore default manual"
- kaytus.ksmanage.edit_restore_factory_default:
- mode: "manual"
- override:
- - fru
- - ntp
- - network
- - user
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Preserver(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'restorefactorydefaults'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- mode=dict(type='str', required=True, choices=['all', 'none', 'manual']),
- override=dict(type='list', elements='str', required=False,
- choices=['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp',
- 'pef', 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']),
- )
- argument_spec.update(ksmanage_argument_spec)
- pre_obj = Preserver(argument_spec)
- pre_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_restore_factory_default +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set preserver config +description: + - Set preserver config on kaytus Server. +notes: + - Does not support C(check_mode). +options: + mode: + description: + - Restore factory defaults mode. + choices: ['all', 'none', 'manual'] + type: str + required: true + override: + description: + - Configuration items that need to be retained. + - Required when I(mode=manual). + choices: ['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', 'pef', + 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user'] + type: list + elements: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Restore default test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set restore default auto" + kaytus.ksmanage.edit_restore_factory_default: + mode: "all" + provider: "{{ ksmanage }}" + + - name: "Set restore default manual" + kaytus.ksmanage.edit_restore_factory_default: + mode: "manual" + override: + - fru + - ntp + - network + - user + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Preserver(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'restorefactorydefaults' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + mode=dict(type='str', required=True, choices=['all', 'none', 'manual']), + override=dict(type='list', elements='str', required=False, + choices=['authentication', 'dcmi', 'fru', 'hostname', 'ipmi', 'kvm', 'network', 'ntp', + 'pef', 'sdr', 'sel', 'smtp', 'snmp', 'sol', 'ssh', 'syslog', 'user']), + ) + argument_spec.update(ksmanage_argument_spec) + pre_obj = Preserver(argument_spec) + pre_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_service.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_service.py index 213fac42d..447b92430 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_service.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_service.py @@ -1,150 +1,150 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_service
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set service settings
-description:
- - Set service settings on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- service_name:
- description:
- - Displays service name of the selected slot(readonly).
- - The I(vnc) option is not supported in M5.
- - The I(fd-media/telnet/snmp) option is not supported in M6.
- choices: ['web', 'kvm', 'cd-media', 'fd-media', 'hd-media', 'ssh', 'telnet', 'solssh', 'snmp', 'vnc']
- type: str
- required: true
- state:
- description:
- - Displays the current status of the service, either active or inactive state.
- - Check this option to start the inactive service.
- choices: ['active', 'inactive']
- type: str
- interface:
- description:
- - It shows the interface in which service is running.
- - The user can choose any one of the available interfaces.
- - Only the M5 model supports this parameter.
- choices: ['eth0', 'eth1', 'both', 'bond0']
- type: str
- non_secure_port:
- description:
- - Used to configure non secure port number for the service.
- - Port value ranges from 1 to 65535.
- type: int
- secure_port:
- description:
- - Used to configure secure port number for the service.
- - Port value ranges from 1 to 65535.
- type: int
- timeout:
- description:
- - Displays the session timeout value of the service.
- - For web, SSH and telnet service, user can configure the session timeout value.
- - Web timeout value ranges from 300 to 1800 seconds.
- - SSH and Telnet timeout value ranges from 60 to 1800 seconds.
- - Timeout value should be in multiples of 60 seconds.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Edit service test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Edit kvm"
- kaytus.ksmanage.edit_service:
- service_name: "kvm"
- state: "active"
- timeout: "1200"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Service(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setservice'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- service_name=dict(type='str', required=True, choices=['web', 'kvm', 'cd-media', 'fd-media', 'hd-media', 'ssh', 'telnet', 'solssh', 'snmp', 'vnc']),
- state=dict(type='str', required=False, choices=['active', 'inactive']),
- interface=dict(type='str', required=False, choices=['eth0', 'eth1', 'both', 'bond0']),
- non_secure_port=dict(type='int', required=False),
- secure_port=dict(type='int', required=False),
- timeout=dict(type='int', required=False)
- )
- argument_spec.update(ksmanage_argument_spec)
- service_obj = Service(argument_spec)
- service_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_service +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set service settings +description: + - Set service settings on kaytus Server. +notes: + - Does not support C(check_mode). +options: + service_name: + description: + - Displays service name of the selected slot(readonly). + - The I(vnc) option is not supported in M5. + - The I(fd-media/telnet/snmp) option is not supported in M6. + choices: ['web', 'kvm', 'cd-media', 'fd-media', 'hd-media', 'ssh', 'telnet', 'solssh', 'snmp', 'vnc'] + type: str + required: true + state: + description: + - Displays the current status of the service, either active or inactive state. + - Check this option to start the inactive service. + choices: ['active', 'inactive'] + type: str + interface: + description: + - It shows the interface in which service is running. + - The user can choose any one of the available interfaces. + - Only the M5 model supports this parameter. + choices: ['eth0', 'eth1', 'both', 'bond0'] + type: str + non_secure_port: + description: + - Used to configure non secure port number for the service. + - Port value ranges from 1 to 65535. + type: int + secure_port: + description: + - Used to configure secure port number for the service. + - Port value ranges from 1 to 65535. + type: int + timeout: + description: + - Displays the session timeout value of the service. + - For web, SSH and telnet service, user can configure the session timeout value. + - Web timeout value ranges from 300 to 1800 seconds. + - SSH and Telnet timeout value ranges from 60 to 1800 seconds. + - Timeout value should be in multiples of 60 seconds. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Edit service test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Edit kvm" + kaytus.ksmanage.edit_service: + service_name: "kvm" + state: "active" + timeout: "1200" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Service(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setservice' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + service_name=dict(type='str', required=True, choices=['web', 'kvm', 'cd-media', 'fd-media', 'hd-media', 'ssh', 'telnet', 'solssh', 'snmp', 'vnc']), + state=dict(type='str', required=False, choices=['active', 'inactive']), + interface=dict(type='str', required=False, choices=['eth0', 'eth1', 'both', 'bond0']), + non_secure_port=dict(type='int', required=False), + secure_port=dict(type='int', required=False), + timeout=dict(type='int', required=False) + ) + argument_spec.update(ksmanage_argument_spec) + service_obj = Service(argument_spec) + service_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp.py index dc2035364..8971c3613 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp.py @@ -1,213 +1,213 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_smtp
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set SMTP information
-description:
- - Set SMTP information on kaytus Server.
- - Only the M5 models support this feature.
-notes:
- - Does not support C(check_mode).
-options:
- interface:
- description:
- - LAN Channel, eth0 is shared, eth1 is dedicated.
- choices: ['eth0', 'eth1', 'bond0']
- type: str
- required: true
- email:
- description:
- - Sender email.
- type: str
- primary_status:
- description:
- - Primary SMTP Support.
- choices: ['enable', 'disable']
- type: str
- primary_ip:
- description:
- - Primary SMTP server IP.
- type: str
- primary_name:
- description:
- - Primary SMTP server name.
- type: str
- primary_port:
- description:
- - Primary SMTP server port, The Identification for retry count configuration(1-65535).
- type: int
- primary_auth:
- description:
- - Primary SMTP server authentication.
- choices: ['enable', 'disable']
- type: str
- primary_username:
- description:
- - Primary SMTP server Username, length be 4 to 64 bits.
- - Must start with letters and cannot contain ', '(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash).
- type: str
- primary_password:
- description:
- - Primary SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space).
- - Required when I(primary_auth=enable).
- type: str
- secondary_status:
- description:
- - Secondary SMTP Support.
- choices: ['enable', 'disable']
- type: str
- secondary_ip:
- description:
- - Secondary SMTP server IP.
- type: str
- secondary_name:
- description:
- - Secondary SMTP server name.
- type: str
- secondary_port:
- description:
- - Secondary SMTP server port, The Identification for retry count configuration(1-65535).
- type: int
- secondary_auth:
- description:
- - Secondary SMTP server authentication.
- choices: ['enable', 'disable']
- type: str
- secondary_username:
- description:
- - Secondary SMTP server Username, length be 4 to 64 bits.
- - Must start with letters and cannot contain ','(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash).
- type: str
- secondary_password:
- description:
- - Secondary SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space).
- - Required when I(secondary_auth=enable).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Smtp test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set smtp information"
- kaytus.ksmanage.edit_smtp:
- interface: "eth0"
- email: "ieit@ieisystem.com"
- primary_status: "enable"
- primary_ip: "100.2.2.2"
- primary_name: "test"
- primary_auth: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set smtp information"
- kaytus.ksmanage.edit_smtp:
- interface: "eth0"
- email: "ieit@ieisystem.com"
- primary_status: "enable"
- primary_ip: "100.2.2.2"
- primary_name: "test"
- primary_auth: "enable"
- primary_username: "test"
- primary_password: my_password
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SMTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsmtp'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']),
- email=dict(type='str', required=False),
- primary_status=dict(type='str', required=False, choices=['enable', 'disable']),
- primary_ip=dict(type='str', required=False),
- primary_name=dict(type='str', required=False),
- primary_port=dict(type='int', required=False),
- primary_auth=dict(type='str', required=False, choices=['enable', 'disable']),
- primary_username=dict(type='str', required=False),
- primary_password=dict(type='str', required=False, no_log=True),
- secondary_status=dict(type='str', required=False, choices=['enable', 'disable']),
- secondary_ip=dict(type='str', required=False),
- secondary_name=dict(type='str', required=False),
- secondary_port=dict(type='int', required=False),
- secondary_auth=dict(type='str', required=False, choices=['enable', 'disable']),
- secondary_username=dict(type='str', required=False),
- secondary_password=dict(type='str', required=False, no_log=True),
-
- )
- argument_spec.update(ksmanage_argument_spec)
- smtp_obj = SMTP(argument_spec)
- smtp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_smtp +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set SMTP information +description: + - Set SMTP information on kaytus Server. + - Only the M5 models support this feature. +notes: + - Does not support C(check_mode). +options: + interface: + description: + - LAN Channel, eth0 is shared, eth1 is dedicated. + choices: ['eth0', 'eth1', 'bond0'] + type: str + required: true + email: + description: + - Sender email. + type: str + primary_status: + description: + - Primary SMTP Support. + choices: ['enable', 'disable'] + type: str + primary_ip: + description: + - Primary SMTP server IP. + type: str + primary_name: + description: + - Primary SMTP server name. + type: str + primary_port: + description: + - Primary SMTP server port, The Identification for retry count configuration(1-65535). + type: int + primary_auth: + description: + - Primary SMTP server authentication. + choices: ['enable', 'disable'] + type: str + primary_username: + description: + - Primary SMTP server Username, length be 4 to 64 bits. + - Must start with letters and cannot contain ', '(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash). + type: str + primary_password: + description: + - Primary SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space). + - Required when I(primary_auth=enable). + type: str + secondary_status: + description: + - Secondary SMTP Support. + choices: ['enable', 'disable'] + type: str + secondary_ip: + description: + - Secondary SMTP server IP. + type: str + secondary_name: + description: + - Secondary SMTP server name. + type: str + secondary_port: + description: + - Secondary SMTP server port, The Identification for retry count configuration(1-65535). + type: int + secondary_auth: + description: + - Secondary SMTP server authentication. + choices: ['enable', 'disable'] + type: str + secondary_username: + description: + - Secondary SMTP server Username, length be 4 to 64 bits. + - Must start with letters and cannot contain ','(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash). + type: str + secondary_password: + description: + - Secondary SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space). + - Required when I(secondary_auth=enable). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Smtp test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set smtp information" + kaytus.ksmanage.edit_smtp: + interface: "eth0" + email: "ieit@ieisystem.com" + primary_status: "enable" + primary_ip: "100.2.2.2" + primary_name: "test" + primary_auth: "disable" + provider: "{{ ksmanage }}" + + - name: "Set smtp information" + kaytus.ksmanage.edit_smtp: + interface: "eth0" + email: "ieit@ieisystem.com" + primary_status: "enable" + primary_ip: "100.2.2.2" + primary_name: "test" + primary_auth: "enable" + primary_username: "test" + primary_password: my_password + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SMTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsmtp' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']), + email=dict(type='str', required=False), + primary_status=dict(type='str', required=False, choices=['enable', 'disable']), + primary_ip=dict(type='str', required=False), + primary_name=dict(type='str', required=False), + primary_port=dict(type='int', required=False), + primary_auth=dict(type='str', required=False, choices=['enable', 'disable']), + primary_username=dict(type='str', required=False), + primary_password=dict(type='str', required=False, no_log=True), + secondary_status=dict(type='str', required=False, choices=['enable', 'disable']), + secondary_ip=dict(type='str', required=False), + secondary_name=dict(type='str', required=False), + secondary_port=dict(type='int', required=False), + secondary_auth=dict(type='str', required=False, choices=['enable', 'disable']), + secondary_username=dict(type='str', required=False), + secondary_password=dict(type='str', required=False, no_log=True), + + ) + argument_spec.update(ksmanage_argument_spec) + smtp_obj = SMTP(argument_spec) + smtp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_com.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_com.py index c66dd6e53..9c31f0a9d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_com.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_com.py @@ -1,204 +1,204 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_smtp_com
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set SMTP information
-description:
- - Set SMTP com information on kaytus Server.
- - Only the M6 models support this feature.
-notes:
- - Does not support C(check_mode).
-options:
- status:
- description:
- - SMTP Support.
- choices: ['enable', 'disable']
- required: true
- type: str
- server_ip:
- description:
- - SMTP server IP.
- type: str
- server_port:
- description:
- - SMTP server port, The Identification for retry count configuration(1-65535).
- type: int
- server_secure_port:
- description:
- - SMTP server secure port, The Identification for retry count configuration(1-65535).
- type: int
- email:
- description:
- - Sender email.
- type: str
- server_auth:
- description:
- - SMTP server authentication.
- choices: ['enable', 'disable']
- type: str
- server_username:
- description:
- - SMTP server Username, length be 4 to 64 bits.
- - Must start with letters and cannot contain ','(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash).
- - Required when I(server_auth=enable).
- type: str
- server_password:
- description:
- - SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space).
- - Required when I(server_auth=enable).
- type: str
- ssl_tls_enable:
- description:
- - SMTP SSLTLS Enable.
- - I(ssl_tls_enable=disable), when I(star_tls_enable=enable).
- choices: ['enable', 'disable']
- type: str
- star_tls_enable:
- description:
- - SMTP STARTTLS Enable.
- - I(star_tls_enable=disable), when I(ssl_tls_enable=enable).
- choices: ['enable', 'disable']
- type: str
- subject:
- description:
- - Email theme.
- type: str
- host_name:
- description:
- - Server name.
- choices: ['enable', 'disable']
- type: str
- serial_number:
- description:
- - Serial number.
- choices: ['enable', 'disable']
- type: str
- asset_tag:
- description:
- - Product asset label.
- choices: ['enable', 'disable']
- type: str
- event_level:
- description:
- - Events above this level will be sent.
- choices: ['Info', 'Warning', 'Critical']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Smtp com test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set smtp com information"
- kaytus.ksmanage.edit_smtp_com:
- status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set smtp com information"
- kaytus.ksmanage.edit_smtp_com:
- status: "enable"
- server_ip: "100.2.2.2"
- email: "ks@kaytus.com"
- server_auth: "enable"
- server_username: "admin"
- server_password: "1234qwer!@#$"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SMTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsmtpcom'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- status=dict(type='str', required=True, choices=['enable', 'disable']),
- server_ip=dict(type='str', required=False),
- server_port=dict(type='int', required=False),
- server_secure_port=dict(type='int', required=False),
- email=dict(type='str', required=False),
- server_auth=dict(type='str', required=False, choices=['enable', 'disable']),
- server_username=dict(type='str', required=False),
- server_password=dict(type='str', required=False, no_log=True),
- ssl_tls_enable=dict(type='str', required=False, choices=['enable', 'disable']),
- star_tls_enable=dict(type='str', required=False, choices=['enable', 'disable']),
- subject=dict(type='str', required=False),
- host_name=dict(type='str', required=False, choices=['enable', 'disable']),
- serial_number=dict(type='str', required=False, choices=['enable', 'disable']),
- asset_tag=dict(type='str', required=False, choices=['enable', 'disable']),
- event_level=dict(type='str', required=False, choices=['Info', 'Warning', 'Critical']),
- )
- argument_spec.update(ksmanage_argument_spec)
- smtp_obj = SMTP(argument_spec)
- smtp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_smtp_com +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set SMTP information +description: + - Set SMTP com information on kaytus Server. + - Only the M6 models support this feature. +notes: + - Does not support C(check_mode). +options: + status: + description: + - SMTP Support. + choices: ['enable', 'disable'] + required: true + type: str + server_ip: + description: + - SMTP server IP. + type: str + server_port: + description: + - SMTP server port, The Identification for retry count configuration(1-65535). + type: int + server_secure_port: + description: + - SMTP server secure port, The Identification for retry count configuration(1-65535). + type: int + email: + description: + - Sender email. + type: str + server_auth: + description: + - SMTP server authentication. + choices: ['enable', 'disable'] + type: str + server_username: + description: + - SMTP server Username, length be 4 to 64 bits. + - Must start with letters and cannot contain ','(comma) ':'(colon) ' '(space) ';'(semicolon) '\\'(backslash). + - Required when I(server_auth=enable). + type: str + server_password: + description: + - SMTP server Password, length be 4 to 64 bits, cannot contain ' '(space). + - Required when I(server_auth=enable). + type: str + ssl_tls_enable: + description: + - SMTP SSLTLS Enable. + - I(ssl_tls_enable=disable), when I(star_tls_enable=enable). + choices: ['enable', 'disable'] + type: str + star_tls_enable: + description: + - SMTP STARTTLS Enable. + - I(star_tls_enable=disable), when I(ssl_tls_enable=enable). + choices: ['enable', 'disable'] + type: str + subject: + description: + - Email theme. + type: str + host_name: + description: + - Server name. + choices: ['enable', 'disable'] + type: str + serial_number: + description: + - Serial number. + choices: ['enable', 'disable'] + type: str + asset_tag: + description: + - Product asset label. + choices: ['enable', 'disable'] + type: str + event_level: + description: + - Events above this level will be sent. + choices: ['Info', 'Warning', 'Critical'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Smtp com test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set smtp com information" + kaytus.ksmanage.edit_smtp_com: + status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set smtp com information" + kaytus.ksmanage.edit_smtp_com: + status: "enable" + server_ip: "100.2.2.2" + email: "ks@kaytus.com" + server_auth: "enable" + server_username: "admin" + server_password: "1234qwer!@#$" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SMTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsmtpcom' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + status=dict(type='str', required=True, choices=['enable', 'disable']), + server_ip=dict(type='str', required=False), + server_port=dict(type='int', required=False), + server_secure_port=dict(type='int', required=False), + email=dict(type='str', required=False), + server_auth=dict(type='str', required=False, choices=['enable', 'disable']), + server_username=dict(type='str', required=False), + server_password=dict(type='str', required=False, no_log=True), + ssl_tls_enable=dict(type='str', required=False, choices=['enable', 'disable']), + star_tls_enable=dict(type='str', required=False, choices=['enable', 'disable']), + subject=dict(type='str', required=False), + host_name=dict(type='str', required=False, choices=['enable', 'disable']), + serial_number=dict(type='str', required=False, choices=['enable', 'disable']), + asset_tag=dict(type='str', required=False, choices=['enable', 'disable']), + event_level=dict(type='str', required=False, choices=['Info', 'Warning', 'Critical']), + ) + argument_spec.update(ksmanage_argument_spec) + smtp_obj = SMTP(argument_spec) + smtp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_dest.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_dest.py index 7216d2e0c..acd8ae016 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_dest.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_smtp_dest.py @@ -1,136 +1,136 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_smtp_dest
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set SMTP information
-description:
- - Set SMTP dest information on kaytus Server.
- - Only the M6 models support this feature.
-notes:
- - Does not support C(check_mode).
-options:
- id:
- description:
- - Email destination id.
- choices: [1, 2, 3, 4]
- type: int
- required: true
- status:
- description:
- - Email enable.
- choices: ['enable', 'disable']
- type: str
- address:
- description:
- - Email address.
- type: str
- description:
- description:
- - Description information.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Smtp dest test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set smtp dest information"
- kaytus.ksmanage.edit_smtp_dest:
- id: 1
- status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set smtp dest information"
- kaytus.ksmanage.edit_smtp_dest:
- id: 1
- status: "enable"
- address: "100.2.2.2"
- description": "test"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SMTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsmtpdest'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- id=dict(type='int', required=True, choices=[1, 2, 3, 4]),
- status=dict(type='str', required=False, choices=['enable', 'disable']),
- address=dict(type='str', required=False),
- description=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- smtp_obj = SMTP(argument_spec)
- smtp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_smtp_dest +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set SMTP information +description: + - Set SMTP dest information on kaytus Server. + - Only the M6 models support this feature. +notes: + - Does not support C(check_mode). +options: + id: + description: + - Email destination id. + choices: [1, 2, 3, 4] + type: int + required: true + status: + description: + - Email enable. + choices: ['enable', 'disable'] + type: str + address: + description: + - Email address. + type: str + description: + description: + - Description information. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Smtp dest test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set smtp dest information" + kaytus.ksmanage.edit_smtp_dest: + id: 1 + status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set smtp dest information" + kaytus.ksmanage.edit_smtp_dest: + id: 1 + status: "enable" + address: "100.2.2.2" + description": "test" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SMTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsmtpdest' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + id=dict(type='int', required=True, choices=[1, 2, 3, 4]), + status=dict(type='str', required=False, choices=['enable', 'disable']), + address=dict(type='str', required=False), + description=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + smtp_obj = SMTP(argument_spec) + smtp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp.py index 60512e324..93ee74c86 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp.py @@ -1,188 +1,188 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_snmp
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set snmp
-description:
- - Set snmp on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- version:
- description:
- - SNMP trap version option, 0 - 'v1', 1 - 'v2c', 2 - 'v3', 3 - 'all', 4 - 'customize'.
- - Only the M5 models support this feature.
- choices: [0, 1, 2, 3, 4]
- type: int
- snmp_status:
- description:
- - NMP read/write status of customize.
- - The input parameters are 'v1get', 'v1set', 'v2cget', 'v2cset', 'v3get', 'v3set', separated by commas, such as v1get, v1set, v2cget.
- - Only the M5 models support this feature.
- type: list
- elements: str
- community:
- description:
- - Community of v1/v2c or v1get/v1set/v2cget/v2cset.
- - Only the M5 models support this feature.
- type: str
- v1status:
- description:
- - SNMP V1 enable.
- choices: ['enable', 'disable']
- type: str
- v2status:
- description:
- - SNMP V2 enable.
- choices: ['enable', 'disable']
- type: str
- v3status:
- description:
- - SNMP V3 enable.
- choices: ['enable', 'disable']
- type: str
- read_community:
- description:
- - Read Only Community, Community should between 1 and 16 characters.
- - Only the M6 models support this feature.
- type: str
- read_write_community:
- description:
- - Read And Write Community, Community should between 1 and 16 characters.
- - Only the M6 models support this feature.
- type: str
- v3username:
- description:
- - Set a username for the V3 trap or v3get/v3set.
- type: str
- auth_protocol:
- description:
- - Choose the authentication protocol for the V3 trap or v3get/v3set.
- choices: ['NONE', 'SHA', 'MD5']
- type: str
- auth_password:
- description:
- - Set the authentication password for the V3 trap or v3get/v3set.
- - The password is a string of 8 to 16 alphanumeric characters.
- - Required when I(auth_protocol) is either C(SHA) or C(MD5).
- type: str
- priv_protocol:
- description:
- - Choose the privacy protocol for the V3 trap or v3get/v3set.
- choices: ['NONE', 'DES', 'AES']
- type: str
- priv_password:
- description:
- - Set the privacy password for the V3 trap or v3get/v3set.
- - The password is a string of 8 to 16 alphanumeric characters.
- - Required when I(priv_protocol) is either C(DES) or C(AES).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Snmp test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set snmp get/set"
- kaytus.ksmanage.edit_snmp:
- community: "test"
- v3username: "test"
- provider: "{{ ksmanage }}"
-
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsnmp'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- version=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]),
- snmp_status=dict(type='list', elements='str', required=False),
- community=dict(type='str', required=False),
- v1status=dict(type='str', required=False, choices=['enable', 'disable']),
- v2status=dict(type='str', required=False, choices=['enable', 'disable']),
- v3status=dict(type='str', required=False, choices=['enable', 'disable']),
- read_community=dict(type='str', required=False),
- read_write_community=dict(type='str', required=False),
- v3username=dict(type='str', required=False),
- auth_protocol=dict(type='str', required=False, choices=['NONE', 'SHA', 'MD5']),
- auth_password=dict(type='str', required=False, no_log=True),
- priv_protocol=dict(type='str', required=False, choices=['NONE', 'DES', 'AES']),
- priv_password=dict(type='str', required=False, no_log=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_snmp +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set snmp +description: + - Set snmp on kaytus Server. +notes: + - Does not support C(check_mode). +options: + version: + description: + - SNMP trap version option, 0 - 'v1', 1 - 'v2c', 2 - 'v3', 3 - 'all', 4 - 'customize'. + - Only the M5 models support this feature. + choices: [0, 1, 2, 3, 4] + type: int + snmp_status: + description: + - NMP read/write status of customize. + - The input parameters are 'v1get', 'v1set', 'v2cget', 'v2cset', 'v3get', 'v3set', separated by commas, such as v1get, v1set, v2cget. + - Only the M5 models support this feature. + type: list + elements: str + community: + description: + - Community of v1/v2c or v1get/v1set/v2cget/v2cset. + - Only the M5 models support this feature. + type: str + v1status: + description: + - SNMP V1 enable. + choices: ['enable', 'disable'] + type: str + v2status: + description: + - SNMP V2 enable. + choices: ['enable', 'disable'] + type: str + v3status: + description: + - SNMP V3 enable. + choices: ['enable', 'disable'] + type: str + read_community: + description: + - Read Only Community, Community should between 1 and 16 characters. + - Only the M6 models support this feature. + type: str + read_write_community: + description: + - Read And Write Community, Community should between 1 and 16 characters. + - Only the M6 models support this feature. + type: str + v3username: + description: + - Set a username for the V3 trap or v3get/v3set. + type: str + auth_protocol: + description: + - Choose the authentication protocol for the V3 trap or v3get/v3set. + choices: ['NONE', 'SHA', 'MD5'] + type: str + auth_password: + description: + - Set the authentication password for the V3 trap or v3get/v3set. + - The password is a string of 8 to 16 alphanumeric characters. + - Required when I(auth_protocol) is either C(SHA) or C(MD5). + type: str + priv_protocol: + description: + - Choose the privacy protocol for the V3 trap or v3get/v3set. + choices: ['NONE', 'DES', 'AES'] + type: str + priv_password: + description: + - Set the privacy password for the V3 trap or v3get/v3set. + - The password is a string of 8 to 16 alphanumeric characters. + - Required when I(priv_protocol) is either C(DES) or C(AES). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Snmp test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set snmp get/set" + kaytus.ksmanage.edit_snmp: + community: "test" + v3username: "test" + provider: "{{ ksmanage }}" + +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsnmp' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + version=dict(type='int', required=False, choices=[0, 1, 2, 3, 4]), + snmp_status=dict(type='list', elements='str', required=False), + community=dict(type='str', required=False), + v1status=dict(type='str', required=False, choices=['enable', 'disable']), + v2status=dict(type='str', required=False, choices=['enable', 'disable']), + v3status=dict(type='str', required=False, choices=['enable', 'disable']), + read_community=dict(type='str', required=False), + read_write_community=dict(type='str', required=False), + v3username=dict(type='str', required=False), + auth_protocol=dict(type='str', required=False, choices=['NONE', 'SHA', 'MD5']), + auth_password=dict(type='str', required=False, no_log=True), + priv_protocol=dict(type='str', required=False, choices=['NONE', 'DES', 'AES']), + priv_password=dict(type='str', required=False, no_log=True), + ) + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp_trap.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp_trap.py index f9226c87a..c09e09091 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp_trap.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_snmp_trap.py @@ -1,217 +1,217 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_snmp_trap
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set snmp trap
-description:
- - Set snmp trap on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- version:
- description:
- - SNMP trap version, 1 is v1, 2 is v2c(v2), 3 is v3, 0 is disable snmp trap.
- - Only the M6 model supports C(0) Settings.
- choices: [0, 1, 2, 3]
- type: int
- event_severity:
- description:
- - Event Severity.
- choices: ['all', 'warning', 'critical']
- type: str
- community:
- description:
- - Community of v1/v2c.
- type: str
- host_id:
- description:
- - Host id.
- - Only the M6 model supports this parameter.
- choices: ['HostName', 'SerialNum', 'AssertTag']
- type: str
- v3username:
- description:
- - Set the username for the V3 trap.
- type: str
- engine_id:
- description:
- - Specifies an engine identifier for the V3 trap. The value should be string of 10 to 48 hex characters, must be even, can be NULL.
- type: str
- auth_protocol:
- description:
- - Choose the authentication protocol for the V3 trap.
- choices: ['NONE', 'SHA', 'MD5']
- type: str
- auth_password:
- description:
- - Set the authentication password for the V3 trap.
- - The password is a string of 8 to 16 alphanumeric characters.
- - Required when I(auth_protocol) is either C(SHA) or C(MD5).
- type: str
- priv_protocol:
- description:
- - Choose the privacy protocol for the V3 trap.
- choices: ['NONE', 'DES', 'AES']
- type: str
- priv_password:
- description:
- - Set the privacy password for the V3 trap.
- - The password is a string of 8 to 16 alphanumeric characters.
- - Required when I(priv_protocol) is either C(DES) or C(AES).
- type: str
- system_name:
- description:
- - Set the system name, can be NULL.
- - Only the M5 model supports this parameter.
- type: str
- system_id:
- description:
- - Set the system ID, can be NULL.
- - Only the M5 model supports this parameter.
- type: str
- location:
- description:
- - Set the host location, can be NULL.
- - Only the M5 model supports this parameter.
- type: str
- contact:
- description:
- - Set the contact, can be NULL.
- - Only the M5 model supports this parameter.
- type: str
- os:
- description:
- - Set the host operating system, can be NULL.
- - Only the M5 model supports this parameter.
- type: str
- trap_port:
- description:
- - Set a port for the SNMP trap in the range of 1 to 65535.
- - Only the M5 model supports this parameter.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Trap test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set snmp trap v2c"
- kaytus.ksmanage.edit_snmp_trap:
- version: 2
- event_severity: "warning"
- community: "test"
- system_name: "ieisystem"
- provider: "{{ ksmanage }}"
-
- - name: "Set snmp trap v3"
- kaytus.ksmanage.edit_snmp_trap:
- version: 3
- event_severity: "all"
- v3username: "ieisystem"
- engine_id: "1234567890"
- auth_protocol: "SHA"
- auth_password: "12345678"
- priv_protocol: "AES"
- priv_password: "123454678"
- trap_port: 162
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setsnmptrap'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- version=dict(type='int', required=False, choices=[0, 1, 2, 3]),
- event_severity=dict(type='str', required=False, choices=['all', 'warning', 'critical']),
- community=dict(type='str', required=False),
- host_id=dict(type='str', required=False, choices=['HostName', 'SerialNum', 'AssertTag']),
- v3username=dict(type='str', required=False),
- engine_id=dict(type='str', required=False),
- auth_protocol=dict(type='str', required=False, choices=['NONE', 'SHA', 'MD5']),
- auth_password=dict(type='str', required=False, no_log=True),
- priv_protocol=dict(type='str', required=False, choices=['NONE', 'DES', 'AES']),
- priv_password=dict(type='str', required=False, no_log=True),
- system_name=dict(type='str', required=False),
- system_id=dict(type='str', required=False),
- location=dict(type='str', required=False),
- contact=dict(type='str', required=False),
- os=dict(type='str', required=False),
- trap_port=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_snmp_trap +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set snmp trap +description: + - Set snmp trap on kaytus Server. +notes: + - Does not support C(check_mode). +options: + version: + description: + - SNMP trap version, 1 is v1, 2 is v2c(v2), 3 is v3, 0 is disable snmp trap. + - Only the M6 model supports C(0) Settings. + choices: [0, 1, 2, 3] + type: int + event_severity: + description: + - Event Severity. + choices: ['all', 'warning', 'critical'] + type: str + community: + description: + - Community of v1/v2c. + type: str + host_id: + description: + - Host id. + - Only the M6 model supports this parameter. + choices: ['HostName', 'SerialNum', 'AssertTag'] + type: str + v3username: + description: + - Set the username for the V3 trap. + type: str + engine_id: + description: + - Specifies an engine identifier for the V3 trap. The value should be string of 10 to 48 hex characters, must be even, can be NULL. + type: str + auth_protocol: + description: + - Choose the authentication protocol for the V3 trap. + choices: ['NONE', 'SHA', 'MD5'] + type: str + auth_password: + description: + - Set the authentication password for the V3 trap. + - The password is a string of 8 to 16 alphanumeric characters. + - Required when I(auth_protocol) is either C(SHA) or C(MD5). + type: str + priv_protocol: + description: + - Choose the privacy protocol for the V3 trap. + choices: ['NONE', 'DES', 'AES'] + type: str + priv_password: + description: + - Set the privacy password for the V3 trap. + - The password is a string of 8 to 16 alphanumeric characters. + - Required when I(priv_protocol) is either C(DES) or C(AES). + type: str + system_name: + description: + - Set the system name, can be NULL. + - Only the M5 model supports this parameter. + type: str + system_id: + description: + - Set the system ID, can be NULL. + - Only the M5 model supports this parameter. + type: str + location: + description: + - Set the host location, can be NULL. + - Only the M5 model supports this parameter. + type: str + contact: + description: + - Set the contact, can be NULL. + - Only the M5 model supports this parameter. + type: str + os: + description: + - Set the host operating system, can be NULL. + - Only the M5 model supports this parameter. + type: str + trap_port: + description: + - Set a port for the SNMP trap in the range of 1 to 65535. + - Only the M5 model supports this parameter. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Trap test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set snmp trap v2c" + kaytus.ksmanage.edit_snmp_trap: + version: 2 + event_severity: "warning" + community: "test" + system_name: "ieisystem" + provider: "{{ ksmanage }}" + + - name: "Set snmp trap v3" + kaytus.ksmanage.edit_snmp_trap: + version: 3 + event_severity: "all" + v3username: "ieisystem" + engine_id: "1234567890" + auth_protocol: "SHA" + auth_password: "12345678" + priv_protocol: "AES" + priv_password: "123454678" + trap_port: 162 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setsnmptrap' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + version=dict(type='int', required=False, choices=[0, 1, 2, 3]), + event_severity=dict(type='str', required=False, choices=['all', 'warning', 'critical']), + community=dict(type='str', required=False), + host_id=dict(type='str', required=False, choices=['HostName', 'SerialNum', 'AssertTag']), + v3username=dict(type='str', required=False), + engine_id=dict(type='str', required=False), + auth_protocol=dict(type='str', required=False, choices=['NONE', 'SHA', 'MD5']), + auth_password=dict(type='str', required=False, no_log=True), + priv_protocol=dict(type='str', required=False, choices=['NONE', 'DES', 'AES']), + priv_password=dict(type='str', required=False, no_log=True), + system_name=dict(type='str', required=False), + system_id=dict(type='str', required=False), + location=dict(type='str', required=False), + contact=dict(type='str', required=False), + os=dict(type='str', required=False), + trap_port=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_threshold.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_threshold.py index 70070aef9..ead3cd040 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_threshold.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_threshold.py @@ -1,141 +1,141 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_threshold
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set threshold information
-description:
- - Set threshold information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- name:
- description:
- - Sensor name.
- type: str
- required: true
- lnr:
- description:
- - Lower non recoverable threshold, should be integer.
- type: int
- lc:
- description:
- - Lower critical threshold, should be integer.
- type: int
- lnc:
- description:
- - Lower non critical threshold, should be integer.
- type: int
- unc:
- description:
- - Up non critical threshold, should be integer.
- type: int
- uc:
- description:
- - Up critical threshold, should be integer.
- type: int
- unr:
- description:
- - Up non recoverable threshold, should be integer.
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Threshold test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set threshold information"
- kaytus.ksmanage.edit_threshold:
- name: "GPU1_Temp"
- uc: 94
- unc: 92
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Threshold(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setthreshold'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- name=dict(type='str', required=True),
- lnr=dict(type='int', required=False),
- lc=dict(type='int', required=False),
- lnc=dict(type='int', required=False),
- unc=dict(type='int', required=False),
- uc=dict(type='int', required=False),
- unr=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- threshoold_obj = Threshold(argument_spec)
- threshoold_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_threshold +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set threshold information +description: + - Set threshold information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + name: + description: + - Sensor name. + type: str + required: true + lnr: + description: + - Lower non recoverable threshold, should be integer. + type: int + lc: + description: + - Lower critical threshold, should be integer. + type: int + lnc: + description: + - Lower non critical threshold, should be integer. + type: int + unc: + description: + - Up non critical threshold, should be integer. + type: int + uc: + description: + - Up critical threshold, should be integer. + type: int + unr: + description: + - Up non recoverable threshold, should be integer. + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Threshold test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set threshold information" + kaytus.ksmanage.edit_threshold: + name: "GPU1_Temp" + uc: 94 + unc: 92 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Threshold(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setthreshold' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + lnr=dict(type='int', required=False), + lc=dict(type='int', required=False), + lnc=dict(type='int', required=False), + unc=dict(type='int', required=False), + uc=dict(type='int', required=False), + unr=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + threshoold_obj = Threshold(argument_spec) + threshoold_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_uid.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_uid.py index 156e8195c..39ea031da 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_uid.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_uid.py @@ -1,121 +1,121 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_uid
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set UID
-description:
- - Set UID on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- led:
- description:
- - Turn on or turn off the led.
- choices: ['on', 'off']
- type: str
- required: true
- time:
- description:
- - Set led blink time(second).
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: UID test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set uid"
- kaytus.ksmanage.edit_uid:
- led: "on"
- time: 10
- provider: "{{ ksmanage }}"
-
- - name: "Set uid"
- kaytus.ksmanage.edit_uid:
- led: "off"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class UID(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setuid'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- led=dict(type='str', required=True, choices=['on', 'off']),
- time=dict(type='int', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- uid_obj = UID(argument_spec)
- uid_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_uid +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set UID +description: + - Set UID on kaytus Server. +notes: + - Does not support C(check_mode). +options: + led: + description: + - Turn on or turn off the led. + choices: ['on', 'off'] + type: str + required: true + time: + description: + - Set led blink time(second). + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: UID test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set uid" + kaytus.ksmanage.edit_uid: + led: "on" + time: 10 + provider: "{{ ksmanage }}" + + - name: "Set uid" + kaytus.ksmanage.edit_uid: + led: "off" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class UID(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setuid' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + led=dict(type='str', required=True, choices=['on', 'off']), + time=dict(type='int', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + uid_obj = UID(argument_spec) + uid_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_virtual_media.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_virtual_media.py index 7b4a7a644..99a998ebc 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_virtual_media.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_virtual_media.py @@ -1,182 +1,182 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_virtual_media
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set virtual media
-description:
- - Set virtual media on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- local_media_support:
- description:
- - To enable or disable Local Media Support, check or uncheck the checkbox respectively.
- - Only the M5 model supports this parameter.
- choices: ['Enable', 'Disable']
- type: str
- remote_media_support:
- description:
- - To enable or disable Remote Media support, check or uncheck the checkbox respectively.
- choices: ['Enable', 'Disable']
- type: str
- mount_type:
- description:
- - Virtual mount type.
- - The I(FD) option is not supported in M6.
- choices: ['CD', 'FD', 'HD']
- type: str
- same_settings:
- description:
- - Same settings with I(CD), 0 is No, 1 is Yes.
- - Required when I(mount_type=0).
- choices: [0, 1]
- type: int
- mount:
- description:
- - Whether to mount virtual media.
- - Only the M5 model supports this parameter.
- choices: ['Enable', 'Disable']
- type: str
- remote_server_address:
- description:
- - Address of the server where the remote media images are stored.
- type: str
- remote_source_path:
- description:
- - Source path to the remote media images..
- type: str
- remote_share_type:
- description:
- - Share Type of the remote media server either NFS or Samba(CIFS).
- choices: ['nfs', 'cifs']
- type: str
- remote_domain_name:
- description:
- - Remote Domain Name, Domain Name field is optional.
- type: str
- remote_user_name:
- description:
- - Remote User Name.
- - Required when I(remote_share_type=cifs).
- type: str
- remote_password:
- description:
- - Remote Password.
- - Required when I(remote_share_type=cifs).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Media test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set local media"
- kaytus.ksmanage.edit_virtual_media:
- local_media_support: "Enable"
- provider: "{{ ksmanage }}"
-
- - name: "Set remote media"
- kaytus.ksmanage.edit_virtual_media:
- remote_media_support: "Enable"
- mount_type: 'CD'
- same_settings: 0
- mount: "Enable"
- remote_server_address: "100.2.28.203"
- remote_source_path: "/data/nfs/server/"
- remote_share_type: "nfs"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Media(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setvirtualmedia'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- local_media_support=dict(type='str', required=False, choices=['Enable', 'Disable']),
- remote_media_support=dict(type='str', required=False, choices=['Enable', 'Disable']),
- mount_type=dict(type='str', required=False, choices=['CD', 'FD', 'HD']),
- same_settings=dict(type='int', required=False, choices=[0, 1]),
- mount=dict(type='str', required=False, choices=['Enable', 'Disable']),
- remote_server_address=dict(type='str', required=False),
- remote_source_path=dict(type='str', required=False),
- remote_share_type=dict(type='str', required=False, choices=['nfs', 'cifs']),
- remote_domain_name=dict(type='str', required=False),
- remote_user_name=dict(type='str', required=False),
- remote_password=dict(type='str', required=False, no_log=True),
- )
- argument_spec.update(ksmanage_argument_spec)
- media_obj = Media(argument_spec)
- media_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_virtual_media +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set virtual media +description: + - Set virtual media on kaytus Server. +notes: + - Does not support C(check_mode). +options: + local_media_support: + description: + - To enable or disable Local Media Support, check or uncheck the checkbox respectively. + - Only the M5 model supports this parameter. + choices: ['Enable', 'Disable'] + type: str + remote_media_support: + description: + - To enable or disable Remote Media support, check or uncheck the checkbox respectively. + choices: ['Enable', 'Disable'] + type: str + mount_type: + description: + - Virtual mount type. + - The I(FD) option is not supported in M6. + choices: ['CD', 'FD', 'HD'] + type: str + same_settings: + description: + - Same settings with I(CD), 0 is No, 1 is Yes. + - Required when I(mount_type=0). + choices: [0, 1] + type: int + mount: + description: + - Whether to mount virtual media. + - Only the M5 model supports this parameter. + choices: ['Enable', 'Disable'] + type: str + remote_server_address: + description: + - Address of the server where the remote media images are stored. + type: str + remote_source_path: + description: + - Source path to the remote media images.. + type: str + remote_share_type: + description: + - Share Type of the remote media server either NFS or Samba(CIFS). + choices: ['nfs', 'cifs'] + type: str + remote_domain_name: + description: + - Remote Domain Name, Domain Name field is optional. + type: str + remote_user_name: + description: + - Remote User Name. + - Required when I(remote_share_type=cifs). + type: str + remote_password: + description: + - Remote Password. + - Required when I(remote_share_type=cifs). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Media test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set local media" + kaytus.ksmanage.edit_virtual_media: + local_media_support: "Enable" + provider: "{{ ksmanage }}" + + - name: "Set remote media" + kaytus.ksmanage.edit_virtual_media: + remote_media_support: "Enable" + mount_type: 'CD' + same_settings: 0 + mount: "Enable" + remote_server_address: "100.2.28.203" + remote_source_path: "/data/nfs/server/" + remote_share_type: "nfs" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Media(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setvirtualmedia' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + local_media_support=dict(type='str', required=False, choices=['Enable', 'Disable']), + remote_media_support=dict(type='str', required=False, choices=['Enable', 'Disable']), + mount_type=dict(type='str', required=False, choices=['CD', 'FD', 'HD']), + same_settings=dict(type='int', required=False, choices=[0, 1]), + mount=dict(type='str', required=False, choices=['Enable', 'Disable']), + remote_server_address=dict(type='str', required=False), + remote_source_path=dict(type='str', required=False), + remote_share_type=dict(type='str', required=False, choices=['nfs', 'cifs']), + remote_domain_name=dict(type='str', required=False), + remote_user_name=dict(type='str', required=False), + remote_password=dict(type='str', required=False, no_log=True), + ) + argument_spec.update(ksmanage_argument_spec) + media_obj = Media(argument_spec) + media_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_vlan.py b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_vlan.py index 97c2df83e..5ec7722ab 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/edit_vlan.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/edit_vlan.py @@ -1,136 +1,136 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: edit_vlan
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Set vlan information
-description:
- - Set vlan information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- interface_name:
- description:
- - Set interface name. Select the LAN interface to be configured.
- choices: ['eth0', 'eth1', 'bond0']
- required: true
- type: str
- vlan_status:
- description:
- - Enable or disable vlan.
- choices: ['enable', 'disable']
- type: str
- vlan_id:
- description:
- - The Identification for VLAN configuration(2-4094).
- type: int
- vlan_priority:
- description:
- - The priority for VLAN configuration(1-7).
- type: int
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Vlan test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Set vlan information"
- kaytus.ksmanage.edit_vlan:
- interface_name: "eth0"
- vlan_status: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set vlan information"
- kaytus.ksmanage.edit_vlan:
- interface_name: "eth0"
- vlan_status: "enable"
- vlan_id: 2
- vlan_priority: 1
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Network(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'setvlan'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']),
- vlan_status=dict(type='str', required=False, choices=['enable', 'disable']),
- vlan_id=dict(type='int', required=False),
- vlan_priority=dict(type='int', required=False),
-
- )
- argument_spec.update(ksmanage_argument_spec)
- net_obj = Network(argument_spec)
- net_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: edit_vlan +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Set vlan information +description: + - Set vlan information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + interface_name: + description: + - Set interface name. Select the LAN interface to be configured. + choices: ['eth0', 'eth1', 'bond0'] + required: true + type: str + vlan_status: + description: + - Enable or disable vlan. + choices: ['enable', 'disable'] + type: str + vlan_id: + description: + - The Identification for VLAN configuration(2-4094). + type: int + vlan_priority: + description: + - The priority for VLAN configuration(1-7). + type: int +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Vlan test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Set vlan information" + kaytus.ksmanage.edit_vlan: + interface_name: "eth0" + vlan_status: "disable" + provider: "{{ ksmanage }}" + + - name: "Set vlan information" + kaytus.ksmanage.edit_vlan: + interface_name: "eth0" + vlan_status: "enable" + vlan_id: 2 + vlan_priority: 1 + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Network(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'setvlan' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + interface_name=dict(type='str', required=True, choices=['eth0', 'eth1', 'bond0']), + vlan_status=dict(type='str', required=False, choices=['enable', 'disable']), + vlan_id=dict(type='int', required=False), + vlan_priority=dict(type='int', required=False), + + ) + argument_spec.update(ksmanage_argument_spec) + net_obj = Network(argument_spec) + net_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_info.py index 89e64f014..3d33cd530 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_info.py @@ -1,126 +1,126 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: event_log_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get event log information
-description:
- - Get event log information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options:
- log_time:
- description:
- - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00.
- type: str
- count:
- description:
- - Get the most recent log of a specified number.
- type: int
- event_file:
- description:
- - Store logs to a file.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Event log info test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get event log information"
- kaytus.ksmanage.event_log_info:
- log_time: "2020-06-01T12:30+08:00"
- provider: "{{ ksmanage }}"
-
- - name: "Get event log information"
- kaytus.ksmanage.event_log_info:
- count: 30
- provider: "{{ ksmanage }}"
-
- - name: "Get event log information"
- kaytus.ksmanage.event_log_info:
- event_file: "/home/wbs/wbs.log"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class EventLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'geteventlog'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- log_time=dict(type='str', required=False),
- count=dict(type='int', required=False),
- event_file=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = EventLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: event_log_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get event log information +description: + - Get event log information on kaytus Server. +notes: + - Supports C(check_mode). +options: + log_time: + description: + - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00. + type: str + count: + description: + - Get the most recent log of a specified number. + type: int + event_file: + description: + - Store logs to a file. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Event log info test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get event log information" + kaytus.ksmanage.event_log_info: + log_time: "2020-06-01T12:30+08:00" + provider: "{{ ksmanage }}" + + - name: "Get event log information" + kaytus.ksmanage.event_log_info: + count: 30 + provider: "{{ ksmanage }}" + + - name: "Get event log information" + kaytus.ksmanage.event_log_info: + event_file: "/home/wbs/wbs.log" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class EventLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'geteventlog' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + log_time=dict(type='str', required=False), + count=dict(type='int', required=False), + event_file=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = EventLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_policy_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_policy_info.py index 04772fbb3..bef7de7d2 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_policy_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/event_log_policy_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: event_log_policy_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get event log policy information
-description:
- - Get event log policy information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Event log policy test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get event log policy information"
- kaytus.ksmanage.event_log_policy_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Log(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'geteventlogpolicy'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- log_obj = Log(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: event_log_policy_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get event log policy information +description: + - Get event log policy information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Event log policy test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get event log policy information" + kaytus.ksmanage.event_log_policy_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Log(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'geteventlogpolicy' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + log_obj = Log(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/fan_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/fan_info.py index 55b38f126..ed7540e41 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/fan_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/fan_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: fan_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get fan information
-description:
- - Get fan information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Fan test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get fan information"
- kaytus.ksmanage.fan_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Fan(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getfan'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- fan_obj = Fan(argument_spec)
- fan_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: fan_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get fan information +description: + - Get fan information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Fan test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get fan information" + kaytus.ksmanage.fan_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Fan(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getfan' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + fan_obj = Fan(argument_spec) + fan_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/fru_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/fru_info.py index 9ed35cd3a..525bbd5dd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/fru_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/fru_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: fru_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get fru information
-description:
- - Get fru information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Fru info test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get fru information"
- kaytus.ksmanage.fru_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Fru(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getfru'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- fru_obj = Fru(argument_spec)
- fru_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: fru_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get fru information +description: + - Get fru information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Fru info test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get fru information" + kaytus.ksmanage.fru_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Fru(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getfru' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + fru_obj = Fru(argument_spec) + fru_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/fw_version_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/fw_version_info.py index f70eb9e13..5dceb31b8 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/fw_version_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/fw_version_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: fw_version_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get firmware version information
-description:
- - Get firmware version information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Firmware version test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get firmware version information"
- kaytus.ksmanage.fw_version_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class FwVersion(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getfw'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- fw_obj = FwVersion(argument_spec)
- fw_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: fw_version_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get firmware version information +description: + - Get firmware version information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Firmware version test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get firmware version information" + kaytus.ksmanage.fw_version_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class FwVersion(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getfw' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + fw_obj = FwVersion(argument_spec) + fw_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/gpu_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/gpu_info.py index e84f29e56..121069961 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/gpu_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/gpu_info.py @@ -1,100 +1,100 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: gpu_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get GPU information
-description:
- - Get GPU information on kaytus Server.
- - Only the M6 models support this feature.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: GPU test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get gpu information"
- kaytus.ksmanage.gpu_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class CPU(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getgpu'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- cpu_obj = CPU(argument_spec)
- cpu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: gpu_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get GPU information +description: + - Get GPU information on kaytus Server. + - Only the M6 models support this feature. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: GPU test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get gpu information" + kaytus.ksmanage.gpu_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class CPU(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getgpu' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + cpu_obj = CPU(argument_spec) + cpu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/hard_disk_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/hard_disk_info.py index 6011a97b4..a0a9885dd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/hard_disk_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/hard_disk_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: hard_disk_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get hard disk information
-description:
- - Get hard disk information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Hard disk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get hard disk information"
- kaytus.ksmanage.hard_disk_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Harddisk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getharddisk'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Harddisk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: hard_disk_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get hard disk information +description: + - Get hard disk information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Hard disk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get hard disk information" + kaytus.ksmanage.hard_disk_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Harddisk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getharddisk' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + disk_obj = Harddisk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/hba_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/hba_info.py index c0a62c9df..577c193bf 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/hba_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/hba_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: hba_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get CPU information
-description:
- - Get HBA information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: HBA test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get hba information"
- kaytus.ksmanage.hba_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class HBA(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'gethba'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- hba_obj = HBA(argument_spec)
- hba_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: hba_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get CPU information +description: + - Get HBA information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: HBA test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get hba information" + kaytus.ksmanage.hba_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class HBA(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'gethba' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + hba_obj = HBA(argument_spec) + hba_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/kvm_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/kvm_info.py index c651c4282..4fbcf4ceb 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/kvm_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/kvm_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: kvm_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get KVM information
-description:
- - Get KVM information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: KVM test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get KVM information"
- kaytus.ksmanage.kvm_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class KVM(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getkvm'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- kvm_obj = KVM(argument_spec)
- kvm_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: kvm_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get KVM information +description: + - Get KVM information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: KVM test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get KVM information" + kaytus.ksmanage.kvm_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class KVM(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getkvm' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + kvm_obj = KVM(argument_spec) + kvm_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group.py index 7a5911643..5300ccc7d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group.py @@ -1,158 +1,158 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ldap_group
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Manage ldap group information
-description:
- - Manage ldap group information on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- state:
- description:
- - Whether the ldap group should exist or not, taking action if the state is different from what is stated.
- choices: ['present', 'absent']
- default: present
- type: str
- name:
- description:
- - Group name.
- type: str
- required: true
- base:
- description:
- - Search Base.
- type: str
- pri:
- description:
- - Group privilege.
- choices: ['administrator', 'user', 'operator', 'oem', 'none']
- type: str
- kvm:
- description:
- - Kvm privilege.
- choices: ['enable', 'disable']
- type: str
- vm:
- description:
- - Vmedia privilege.
- choices: ['enable', 'disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ldap group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Add ldap group information"
- kaytus.ksmanage.ldap_group:
- state: "present"
- name: "wbs"
- base: "cn=manager"
- pri: "administrator"
- kvm: "enable"
- vm: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Set ldap group information"
- kaytus.ksmanage.ldap_group:
- state: "present"
- name: "wbs"
- pri: "user"
- kvm: "disable"
- provider: "{{ ksmanage }}"
-
- - name: "Delete ldap group information"
- kaytus.ksmanage.ldap_group:
- state: "absent"
- name: "wbs"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LDAP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'editldapgroup'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- state=dict(type='str', choices=['present', 'absent'], default='present'),
- name=dict(type='str', required=True),
- base=dict(type='str', required=False),
- pri=dict(type='str', required=False, choices=['administrator', 'user', 'operator', 'oem', 'none']),
- kvm=dict(type='str', required=False, choices=['enable', 'disable']),
- vm=dict(type='str', required=False, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- ldap_obj = LDAP(argument_spec)
- ldap_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ldap_group +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Manage ldap group information +description: + - Manage ldap group information on kaytus Server. +notes: + - Does not support C(check_mode). +options: + state: + description: + - Whether the ldap group should exist or not, taking action if the state is different from what is stated. + choices: ['present', 'absent'] + default: present + type: str + name: + description: + - Group name. + type: str + required: true + base: + description: + - Search Base. + type: str + pri: + description: + - Group privilege. + choices: ['administrator', 'user', 'operator', 'oem', 'none'] + type: str + kvm: + description: + - Kvm privilege. + choices: ['enable', 'disable'] + type: str + vm: + description: + - Vmedia privilege. + choices: ['enable', 'disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ldap group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Add ldap group information" + kaytus.ksmanage.ldap_group: + state: "present" + name: "wbs" + base: "cn=manager" + pri: "administrator" + kvm: "enable" + vm: "disable" + provider: "{{ ksmanage }}" + + - name: "Set ldap group information" + kaytus.ksmanage.ldap_group: + state: "present" + name: "wbs" + pri: "user" + kvm: "disable" + provider: "{{ ksmanage }}" + + - name: "Delete ldap group information" + kaytus.ksmanage.ldap_group: + state: "absent" + name: "wbs" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LDAP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'editldapgroup' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + state=dict(type='str', choices=['present', 'absent'], default='present'), + name=dict(type='str', required=True), + base=dict(type='str', required=False), + pri=dict(type='str', required=False, choices=['administrator', 'user', 'operator', 'oem', 'none']), + kvm=dict(type='str', required=False, choices=['enable', 'disable']), + vm=dict(type='str', required=False, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + ldap_obj = LDAP(argument_spec) + ldap_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group_info.py index 92c5e1ec7..68c12bbea 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_group_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ldap_group_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get ldap group information
-description:
- - Get ldap group information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ldap group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get ldap group information"
- kaytus.ksmanage.ldap_group_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LDAP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getldapgroup'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ldap_obj = LDAP(argument_spec)
- ldap_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ldap_group_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get ldap group information +description: + - Get ldap group information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ldap group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get ldap group information" + kaytus.ksmanage.ldap_group_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LDAP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getldapgroup' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ldap_obj = LDAP(argument_spec) + ldap_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_info.py index 9d3c01628..34a9f8e24 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ldap_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ldap_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get ldap information
-description:
- - Get ldap information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ldap test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get ldap information"
- kaytus.ksmanage.ldap_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LDAP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getldap'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ldap_obj = LDAP(argument_spec)
- ldap_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ldap_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get ldap information +description: + - Get ldap information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ldap test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get ldap information" + kaytus.ksmanage.ldap_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LDAP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getldap' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ldap_obj = LDAP(argument_spec) + ldap_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ldisk_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ldisk_info.py index 530a3980c..ebe521361 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ldisk_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ldisk_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ldisk_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get logical disks information
-description:
- - Get logical disks information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Ldisk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get logical disks information"
- kaytus.ksmanage.ldisk_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getldisk'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ldisk_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get logical disks information +description: + - Get logical disks information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Ldisk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get logical disks information" + kaytus.ksmanage.ldisk_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getldisk' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/log_setting_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/log_setting_info.py index 2a2f1ab34..645dde819 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/log_setting_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/log_setting_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: log_setting_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get bmc log setting information
-description:
- - Get bmc log setting information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bmc log setting test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bmc log setting information"
- kaytus.ksmanage.log_setting_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class LogSetting(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getbmclogsettings'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- cpu_obj = LogSetting(argument_spec)
- cpu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: log_setting_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get bmc log setting information +description: + - Get bmc log setting information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bmc log setting test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bmc log setting information" + kaytus.ksmanage.log_setting_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class LogSetting(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getbmclogsettings' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + cpu_obj = LogSetting(argument_spec) + cpu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/media_instance_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/media_instance_info.py index 4071e1b77..a2f2c4659 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/media_instance_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/media_instance_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: media_instance_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get Virtual Media Instance information
-description:
- - Get Virtual Media Instance information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Media instance test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get Virtual Media Instance information"
- kaytus.ksmanage.media_instance_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Instance(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getmediainstance'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- instance_obj = Instance(argument_spec)
- instance_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: media_instance_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get Virtual Media Instance information +description: + - Get Virtual Media Instance information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Media instance test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get Virtual Media Instance information" + kaytus.ksmanage.media_instance_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Instance(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getmediainstance' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + instance_obj = Instance(argument_spec) + instance_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/mem_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/mem_info.py index e0d60a76b..13902c3be 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/mem_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/mem_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: mem_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get memory information
-description:
- - Get memory information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Memory test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get memory information"
- kaytus.ksmanage.mem_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Memory(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getmemory'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- mem_obj = Memory(argument_spec)
- mem_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: mem_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get memory information +description: + - Get memory information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Memory test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get memory information" + kaytus.ksmanage.mem_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Memory(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getmemory' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + mem_obj = Memory(argument_spec) + mem_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ncsi_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ncsi_info.py index 2b423c69b..5d41892bb 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ncsi_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ncsi_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ncsi_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get ncsi information
-description:
- - Get ncsi information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: NCSI test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get ncsi information"
- kaytus.ksmanage.ncsi_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class NCSI(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getncsi'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ncsi_obj = NCSI(argument_spec)
- ncsi_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ncsi_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get ncsi information +description: + - Get ncsi information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: NCSI test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get ncsi information" + kaytus.ksmanage.ncsi_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class NCSI(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getncsi' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ncsi_obj = NCSI(argument_spec) + ncsi_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/network_bond_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/network_bond_info.py index 21b1178cd..b76aeee6f 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/network_bond_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/network_bond_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: network_bond_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get network bond information
-description:
- - Get network bond information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bond test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get network bond information"
- kaytus.ksmanage.network_bond_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Bond(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getnetworkbond'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- bond_obj = Bond(argument_spec)
- bond_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: network_bond_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get network bond information +description: + - Get network bond information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bond test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get network bond information" + kaytus.ksmanage.network_bond_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Bond(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getnetworkbond' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + bond_obj = Bond(argument_spec) + bond_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/network_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/network_info.py index ae778635f..56d28d923 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/network_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/network_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: network_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get network information
-description:
- - Get network information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Network test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get network information"
- kaytus.ksmanage.network_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Network(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getnetwork'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- net_obj = Network(argument_spec)
- net_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: network_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get network information +description: + - Get network information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Network test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get network information" + kaytus.ksmanage.network_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Network(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getnetwork' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + net_obj = Network(argument_spec) + net_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/network_link_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/network_link_info.py index 065d51021..6f98e42af 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/network_link_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/network_link_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: network_link_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get network link information
-description:
- - Get network link information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Link test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get network link information"
- kaytus.ksmanage.network_link_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Link(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getnetworklink'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- link_obj = Link(argument_spec)
- link_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: network_link_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get network link information +description: + - Get network link information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Link test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get network link information" + kaytus.ksmanage.network_link_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Link(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getnetworklink' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + link_obj = Link(argument_spec) + link_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/ntp_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/ntp_info.py index a8579c043..6161ad347 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/ntp_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/ntp_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: ntp_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get NTP information
-description:
- - Get NTP information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: NTP test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get ntp information"
- kaytus.ksmanage.ntp_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class NTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'gettime'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- ntp_obj = NTP(argument_spec)
- ntp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: ntp_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get NTP information +description: + - Get NTP information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: NTP test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get ntp information" + kaytus.ksmanage.ntp_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class NTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'gettime' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + ntp_obj = NTP(argument_spec) + ntp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/onboard_disk_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/onboard_disk_info.py index 33afd524f..c8a15e93b 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/onboard_disk_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/onboard_disk_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: onboard_disk_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get onboard disks information
-description:
- - Get onboard disks information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Onboard test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get onboard disks information"
- kaytus.ksmanage.onboard_disk_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'gethdddisk'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: onboard_disk_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get onboard disks information +description: + - Get onboard disks information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Onboard test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get onboard disks information" + kaytus.ksmanage.onboard_disk_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'gethdddisk' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/pcie_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/pcie_info.py index 528e122a0..d96aa1e44 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/pcie_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/pcie_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: pcie_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get PCIE information
-description:
- - Get PCIE information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: PCIE test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get PCIE information"
- kaytus.ksmanage.pcie_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class PCIE(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpcie'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- pcie_obj = PCIE(argument_spec)
- pcie_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: pcie_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get PCIE information +description: + - Get PCIE information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: PCIE test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get PCIE information" + kaytus.ksmanage.pcie_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class PCIE(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpcie' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + pcie_obj = PCIE(argument_spec) + pcie_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/pdisk_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/pdisk_info.py index f294fd0a6..e8d922fba 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/pdisk_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/pdisk_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: pdisk_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get physical disks information
-description:
- - Get physical disks information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Pdisk test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get physical disks information"
- kaytus.ksmanage.pdisk_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Disk(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpdisk'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- disk_obj = Disk(argument_spec)
- disk_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: pdisk_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get physical disks information +description: + - Get physical disks information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Pdisk test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get physical disks information" + kaytus.ksmanage.pdisk_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Disk(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpdisk' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + disk_obj = Disk(argument_spec) + disk_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/power_budget_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/power_budget_info.py index d2631de2f..d15537052 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/power_budget_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/power_budget_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: power_budget_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get power budget information
-description:
- - Get power budget information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power budget test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get power budget information"
- kaytus.ksmanage.power_budget_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpowerbudget'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: power_budget_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get power budget information +description: + - Get power budget information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power budget test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get power budget information" + kaytus.ksmanage.power_budget_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpowerbudget' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/power_consumption_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/power_consumption_info.py index 0f899c662..20ea50f15 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/power_consumption_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/power_consumption_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: power_consumption_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get power consumption information
-description:
- - Get power consumption information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power consumption test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get power consumption information"
- kaytus.ksmanage.power_consumption_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpowerconsumption'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: power_consumption_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get power consumption information +description: + - Get power consumption information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power consumption test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get power consumption information" + kaytus.ksmanage.power_consumption_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpowerconsumption' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/power_restore_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/power_restore_info.py index 519729ea6..382e80ae4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/power_restore_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/power_restore_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: power_restore_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get power restore information
-description:
- - Get power restore information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power restore test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get power restore information"
- kaytus.ksmanage.power_restore_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpowerrestore'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: power_restore_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get power restore information +description: + - Get power restore information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power restore test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get power restore information" + kaytus.ksmanage.power_restore_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpowerrestore' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/power_status_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/power_status_info.py index c3b32b145..bfa4e776b 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/power_status_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/power_status_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: power_status_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get power status information
-description:
- - Get power status information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Power status test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get power status information"
- kaytus.ksmanage.power_status_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Power(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpowerstatus'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- power_obj = Power(argument_spec)
- power_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: power_status_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get power status information +description: + - Get power status information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Power status test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get power status information" + kaytus.ksmanage.power_status_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Power(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpowerstatus' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + power_obj = Power(argument_spec) + power_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/preserve_config_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/preserve_config_info.py index 08f597174..87b283342 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/preserve_config_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/preserve_config_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: preserve_config_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get preserve config information
-description:
- - Get preserve config information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Preserve test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get preserve config information"
- kaytus.ksmanage.preserve_config_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Preserver(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpreserveconfig'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- pre_obj = Preserver(argument_spec)
- pre_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: preserve_config_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get preserve config information +description: + - Get preserve config information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Preserve test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get preserve config information" + kaytus.ksmanage.preserve_config_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Preserver(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpreserveconfig' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + pre_obj = Preserver(argument_spec) + pre_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_config_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_config_info.py index 7a2f1c7f1..68649bedf 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_config_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_config_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: psu_config_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get psu config information
-description:
- - Get psu config information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Psu config test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get psu config information"
- kaytus.ksmanage.psu_config_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Psu(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpsuconfig'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- psu_obj = Psu(argument_spec)
- psu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: psu_config_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get psu config information +description: + - Get psu config information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Psu config test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get psu config information" + kaytus.ksmanage.psu_config_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Psu(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpsuconfig' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + psu_obj = Psu(argument_spec) + psu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_info.py index df4b85861..1c7fd8f4b 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: psu_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get psu information
-description:
- - Get psu information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Psu test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get psu information"
- kaytus.ksmanage.psu_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Psu(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpsu'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- psu_obj = Psu(argument_spec)
- psu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: psu_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get psu information +description: + - Get psu information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Psu test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get psu information" + kaytus.ksmanage.psu_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Psu(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpsu' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + psu_obj = Psu(argument_spec) + psu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_peak_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_peak_info.py index 4b4b6f0e0..9916fd86a 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/psu_peak_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/psu_peak_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: psu_peak_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get psu peak information
-description:
- - Get psu peak information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Psu peak test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get psu peak information"
- kaytus.ksmanage.psu_peak_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Psu(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getpsupeak'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- psu_obj = Psu(argument_spec)
- psu_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: psu_peak_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get psu peak information +description: + - Get psu peak information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Psu peak test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get psu peak information" + kaytus.ksmanage.psu_peak_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Psu(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getpsupeak' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + psu_obj = Psu(argument_spec) + psu_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/raid_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/raid_info.py index 8b321de2d..6556a8d09 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/raid_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/raid_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: raid_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get RAID/HBA card and controller information
-description:
- - Get RAID/HBA card and controller information information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Raid test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get raid information"
- kaytus.ksmanage.raid_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Raid(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getraid'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- raid_obj = Raid(argument_spec)
- raid_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: raid_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get RAID/HBA card and controller information +description: + - Get RAID/HBA card and controller information information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Raid test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get raid information" + kaytus.ksmanage.raid_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Raid(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getraid' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + raid_obj = Raid(argument_spec) + raid_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/reset_bmc.py b/ansible_collections/kaytus/ksmanage/plugins/modules/reset_bmc.py index 2a1b38a13..46f7404db 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/reset_bmc.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/reset_bmc.py @@ -1,101 +1,101 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: reset_bmc
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: BMC reset
-description:
- - BMC reset on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Reset bmc test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Reset bmc"
- kaytus.ksmanage.reset_bmc:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Reset(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'resetbmc'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- reset_obj = Reset(argument_spec)
- reset_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: reset_bmc +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: BMC reset +description: + - BMC reset on kaytus Server. +notes: + - Does not support C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Reset bmc test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Reset bmc" + kaytus.ksmanage.reset_bmc: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Reset(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'resetbmc' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + reset_obj = Reset(argument_spec) + reset_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/reset_kvm.py b/ansible_collections/kaytus/ksmanage/plugins/modules/reset_kvm.py index 10d2c8161..7c785fc34 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/reset_kvm.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/reset_kvm.py @@ -1,101 +1,101 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: reset_kvm
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: KVM reset
-description:
- - KVM reset on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Reset kvm test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Reset kvm"
- kaytus.ksmanage.reset_kvm:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Reset(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'resetkvm'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- reset_obj = Reset(argument_spec)
- reset_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: reset_kvm +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: KVM reset +description: + - KVM reset on kaytus Server. +notes: + - Does not support C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Reset kvm test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Reset kvm" + kaytus.ksmanage.reset_kvm: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Reset(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'resetkvm' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + reset_obj = Reset(argument_spec) + reset_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/restore.py b/ansible_collections/kaytus/ksmanage/plugins/modules/restore.py index f77bb1112..6f3b3e752 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/restore.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/restore.py @@ -1,117 +1,117 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: restore
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Restore server settings
-description:
- - Restore server settings on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- bak_file:
- description:
- - Select backup file or bak folder.
- required: true
- type: str
- item:
- description:
- - Select export item.
- - Only the M5 model supports this parameter.
- choices: ['all', 'network', 'dns', 'service', 'ntp', 'smtp', 'snmptrap', 'ad', 'ldap', 'user', 'bios']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Restore test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Restore server settings"
- kaytus.ksmanage.restore:
- bak_file: "/home/wbs/backfile"
- item: "all"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Restore(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'restore'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- bak_file=dict(type='str', required=True),
- item=dict(type='str', required=False, choices=['all', 'network', 'dns', 'service', 'ntp', 'smtp', 'snmptrap', 'ad', 'ldap', 'user', 'bios']),
- )
- argument_spec.update(ksmanage_argument_spec)
- restore_obj = Restore(argument_spec)
- restore_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: restore +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Restore server settings +description: + - Restore server settings on kaytus Server. +notes: + - Does not support C(check_mode). +options: + bak_file: + description: + - Select backup file or bak folder. + required: true + type: str + item: + description: + - Select export item. + - Only the M5 model supports this parameter. + choices: ['all', 'network', 'dns', 'service', 'ntp', 'smtp', 'snmptrap', 'ad', 'ldap', 'user', 'bios'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Restore test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Restore server settings" + kaytus.ksmanage.restore: + bak_file: "/home/wbs/backfile" + item: "all" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Restore(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'restore' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + bak_file=dict(type='str', required=True), + item=dict(type='str', required=False, choices=['all', 'network', 'dns', 'service', 'ntp', 'smtp', 'snmptrap', 'ad', 'ldap', 'user', 'bios']), + ) + argument_spec.update(ksmanage_argument_spec) + restore_obj = Restore(argument_spec) + restore_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/self_test_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/self_test_info.py index 3b21f7b03..5f357ee9e 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/self_test_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/self_test_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: self_test_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get self test information
-description:
- - Get self test information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Self test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get self test information"
- kaytus.ksmanage.self_test_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Test(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getselftest'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- test_obj = Test(argument_spec)
- test_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: self_test_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get self test information +description: + - Get self test information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Self test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get self test information" + kaytus.ksmanage.self_test_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Test(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getselftest' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + test_obj = Test(argument_spec) + test_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/sensor_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/sensor_info.py index ef5afdc4b..f954cb283 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/sensor_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/sensor_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: sensor_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get sensor information
-description:
- - Get sensor information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Sensor test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get sensor information"
- kaytus.ksmanage.sensor_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Sensor(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsensor'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- sensor_obj = Sensor(argument_spec)
- sensor_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: sensor_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get sensor information +description: + - Get sensor information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Sensor test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get sensor information" + kaytus.ksmanage.sensor_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Sensor(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsensor' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + sensor_obj = Sensor(argument_spec) + sensor_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/server_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/server_info.py index 72361a41e..2cfb6f42a 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/server_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/server_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: server_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get server status information
-description:
- - Get server status information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Server test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get server status information"
- kaytus.ksmanage.server_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class ServerStatus(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getserver'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- server_obj = ServerStatus(argument_spec)
- server_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: server_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get server status information +description: + - Get server status information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Server test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get server status information" + kaytus.ksmanage.server_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class ServerStatus(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getserver' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + server_obj = ServerStatus(argument_spec) + server_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/service_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/service_info.py index b2294552f..186af8fbd 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/service_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/service_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: service_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get service information
-description:
- - Get service information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Service info test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get service information"
- kaytus.ksmanage.service_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Service(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getservice'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- service_obj = Service(argument_spec)
- service_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: service_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get service information +description: + - Get service information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Service info test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get service information" + kaytus.ksmanage.service_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Service(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getservice' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + service_obj = Service(argument_spec) + service_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/session_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/session_info.py index b8ea756f6..a7bb3397b 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/session_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/session_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: session_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get online session information
-description:
- - Get online session information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Session test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get session information"
- kaytus.ksmanage.session_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Session(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsessions'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- session_obj = Session(argument_spec)
- session_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: session_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get online session information +description: + - Get online session information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Session test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get session information" + kaytus.ksmanage.session_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Session(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsessions' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + session_obj = Session(argument_spec) + session_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/smtp_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/smtp_info.py index 9f8700c03..e24318476 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/smtp_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/smtp_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: smtp_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get SMTP information
-description:
- - Get SMTP information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Smtp test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get smtp information"
- kaytus.ksmanage.smtp_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SMTP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsmtp'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- smtp_obj = SMTP(argument_spec)
- smtp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: smtp_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get SMTP information +description: + - Get SMTP information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Smtp test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get smtp information" + kaytus.ksmanage.smtp_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SMTP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsmtp' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + smtp_obj = SMTP(argument_spec) + smtp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_info.py index 4f40991e3..16934d760 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: snmp_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get snmp get/set information
-description:
- - Get snmp get/set information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Snmp test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get snmp get/set information"
- kaytus.ksmanage.snmp_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsnmp'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: snmp_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get snmp get/set information +description: + - Get snmp get/set information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Snmp test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get snmp get/set information" + kaytus.ksmanage.snmp_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsnmp' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_trap_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_trap_info.py index 1ecebd66e..20b015eec 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_trap_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/snmp_trap_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: snmp_trap_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get snmp trap information
-description:
- - Get snmp trap information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Trap test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get snmp trap information"
- kaytus.ksmanage.snmp_trap_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SNMP(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsnmptrap'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- snmp_obj = SNMP(argument_spec)
- snmp_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: snmp_trap_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get snmp trap information +description: + - Get snmp trap information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Trap test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get snmp trap information" + kaytus.ksmanage.snmp_trap_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SNMP(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsnmptrap' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + snmp_obj = SNMP(argument_spec) + snmp_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/support_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/support_info.py index 711de031d..fb18b9c63 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/support_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/support_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: support_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get support information
-description:
- - Get the kaytus Server support list information.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Support list test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get support information"
- kaytus.ksmanage.support_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Support(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'support_model'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- support_obj = Support(argument_spec)
- support_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: support_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get support information +description: + - Get the kaytus Server support list information. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Support list test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get support information" + kaytus.ksmanage.support_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Support(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'support_model' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + support_obj = Support(argument_spec) + support_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/system_log_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/system_log_info.py index c74f38001..3482025bf 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/system_log_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/system_log_info.py @@ -1,134 +1,134 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: system_log_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get BMC system log information
-description:
- - Get BMC system log information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options:
- level:
- description:
- - Log level.
- default: alert
- choices: ['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info']
- type: str
- log_time:
- description:
- - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00.
- type: str
- count:
- description:
- - Get the most recent log of a specified number.
- type: int
- system_file:
- description:
- - Store logs to a file.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Bmc system log info test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get bmc system log information"
- kaytus.ksmanage.system_log_info:
- level: "alert"
- log_time: "2020-06-01T12:30+08:00"
- provider: "{{ ksmanage }}"
-
- - name: "Get bmc system log information"
- kaytus.ksmanage.system_log_info:
- count: 30
- provider: "{{ ksmanage }}"
-
- - name: "Get bmc system log information"
- kaytus.ksmanage.system_log_info:
- system_file: "/home/wbs/wbs.log"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class SystemLog(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getsystemlog'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- level=dict(type='str', default='alert', choices=['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info']),
- log_time=dict(type='str', required=False),
- count=dict(type='int', required=False),
- system_file=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- log_obj = SystemLog(argument_spec)
- log_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: system_log_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get BMC system log information +description: + - Get BMC system log information on kaytus Server. +notes: + - Supports C(check_mode). +options: + level: + description: + - Log level. + default: alert + choices: ['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info'] + type: str + log_time: + description: + - Get logs after the specified date, time should be YYYY-MM-DDTHH:MM+HH:MM, like 2019-06-27T12:30+08:00. + type: str + count: + description: + - Get the most recent log of a specified number. + type: int + system_file: + description: + - Store logs to a file. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Bmc system log info test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get bmc system log information" + kaytus.ksmanage.system_log_info: + level: "alert" + log_time: "2020-06-01T12:30+08:00" + provider: "{{ ksmanage }}" + + - name: "Get bmc system log information" + kaytus.ksmanage.system_log_info: + count: 30 + provider: "{{ ksmanage }}" + + - name: "Get bmc system log information" + kaytus.ksmanage.system_log_info: + system_file: "/home/wbs/wbs.log" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class SystemLog(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getsystemlog' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + level=dict(type='str', default='alert', choices=['alert', 'critical', 'error', 'notice', 'warning', 'debug', 'emergency', 'info']), + log_time=dict(type='str', required=False), + count=dict(type='int', required=False), + system_file=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + log_obj = SystemLog(argument_spec) + log_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/temp_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/temp_info.py index a8fbef6ff..8afa5f7ab 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/temp_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/temp_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: temp_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get temp information
-description:
- - Get temp information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Temp test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get temp information"
- kaytus.ksmanage.temp_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Sensor(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'gettemp'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- sensor_obj = Sensor(argument_spec)
- sensor_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: temp_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get temp information +description: + - Get temp information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Temp test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get temp information" + kaytus.ksmanage.temp_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Sensor(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'gettemp' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + sensor_obj = Sensor(argument_spec) + sensor_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/threshold_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/threshold_info.py index ae4dbfbbf..03967dece 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/threshold_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/threshold_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: threshold_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get threshold information
-description:
- - Get threshold information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Threshold test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get threshold information"
- kaytus.ksmanage.threshold_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Threshold(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getthreshold'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- threshoold_obj = Threshold(argument_spec)
- threshoold_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: threshold_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get threshold information +description: + - Get threshold information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Threshold test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get threshold information" + kaytus.ksmanage.threshold_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Threshold(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getthreshold' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + threshoold_obj = Threshold(argument_spec) + threshoold_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/uid_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/uid_info.py index b24547181..2625b51cb 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/uid_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/uid_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: uid_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get UID information
-description:
- - Get UID information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: UID test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get UID information"
- kaytus.ksmanage.uid_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class UID(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getuid'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- uid_obj = UID(argument_spec)
- uid_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: uid_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get UID information +description: + - Get UID information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: UID test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get UID information" + kaytus.ksmanage.uid_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class UID(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getuid' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + uid_obj = UID(argument_spec) + uid_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/update_cpld.py b/ansible_collections/kaytus/ksmanage/plugins/modules/update_cpld.py index 0a20e6a11..9fbfa30f8 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/update_cpld.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/update_cpld.py @@ -1,130 +1,130 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: update_cpld
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Update CPLD
-description:
- - Update CPLD on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- list:
- description:
- - Get cpld list.
- - Only the M5 model supports this parameter.
- choices: [True, False]
- default: False
- type: bool
- id:
- description:
- - CPLD id.
- - Required when I(list=False).
- - Only the M5 model supports this parameter.
- type: int
- file_url:
- description:
- - CPLD image file path.
- - Required when I(list=False).
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: CPLD test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get cpld list"
- kaytus.ksmanage.update_cpld:
- list: True
- provider: "{{ ksmanage }}"
-
- - name: "Update cpld"
- update_cpld:
- id: 1
- file_url: "home/wbs/raw.bin"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class CPLD(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'updatecpld'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- list=dict(type='bool', default=False, choices=[True, False]),
- id=dict(type='int', required=False),
- file_url=dict(type='str', required=False),
- )
- argument_spec.update(ksmanage_argument_spec)
- cpld_obj = CPLD(argument_spec)
- cpld_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: update_cpld +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Update CPLD +description: + - Update CPLD on kaytus Server. +notes: + - Does not support C(check_mode). +options: + list: + description: + - Get cpld list. + - Only the M5 model supports this parameter. + choices: [True, False] + default: False + type: bool + id: + description: + - CPLD id. + - Required when I(list=False). + - Only the M5 model supports this parameter. + type: int + file_url: + description: + - CPLD image file path. + - Required when I(list=False). + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: CPLD test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get cpld list" + kaytus.ksmanage.update_cpld: + list: True + provider: "{{ ksmanage }}" + + - name: "Update cpld" + update_cpld: + id: 1 + file_url: "home/wbs/raw.bin" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class CPLD(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'updatecpld' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + list=dict(type='bool', default=False, choices=[True, False]), + id=dict(type='int', required=False), + file_url=dict(type='str', required=False), + ) + argument_spec.update(ksmanage_argument_spec) + cpld_obj = CPLD(argument_spec) + cpld_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/update_fw.py b/ansible_collections/kaytus/ksmanage/plugins/modules/update_fw.py index 43b18d287..cdfbc10e6 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/update_fw.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/update_fw.py @@ -1,154 +1,154 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: update_fw
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Update firmware
-description:
- - Update firmware on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- url:
- description:
- - Firmware image url.
- required: true
- type: str
- mode:
- description:
- - Active mode, Manual or Auto(default).
- default: Auto
- choices: ['Auto', 'Manual']
- type: str
- type:
- description:
- - Firmware type.
- choices: ['BMC', 'BIOS']
- type: str
- over_ride:
- description:
- - Reserve Configurations, 0-reserve, 1-override.
- default: 0
- choices: [0, 1]
- type: int
- has_me:
- description:
- - Update me or not when update bios, only work in INTEL platform, 0-no, 1-yes.
- - Only the M5 model supports this parameter.
- default: 1
- choices: [0, 1]
- type: int
- dual_image:
- description:
- - Update dual image(default) or not.
- - Only the M5 model supports this parameter.
- default: dual
- choices: ['single', 'dual']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Update fw test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "update bios"
- kaytus.ksmanage.update_fw:
- url: "/home/wbs/SA5112M5_BIOS_4.1.8_Standard_20200117.bin"
- type: "BIOS"
- provider: "{{ ksmanage }}"
-
- - name: "update bmc"
- kaytus.ksmanage.update_fw:
- url: "/home/wbs/SA5112M5_BMC_4.17.7_Standard_20200430"
- mode: "Auto"
- type: "BMC"
- dual_image: "dual"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Update(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'fwupdate'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- url=dict(type='str', required=True),
- mode=dict(type='str', default='Auto', choices=['Auto', 'Manual']),
- over_ride=dict(type='int', default=0, choices=[0, 1]),
- type=dict(type='str', required=False, choices=['BMC', 'BIOS']),
- has_me=dict(type='int', default=1, choices=[0, 1]),
- dual_image=dict(type='str', default='dual', choices=['single', 'dual']),
- )
- argument_spec.update(ksmanage_argument_spec)
- update_obj = Update(argument_spec)
- update_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: update_fw +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Update firmware +description: + - Update firmware on kaytus Server. +notes: + - Does not support C(check_mode). +options: + url: + description: + - Firmware image url. + required: true + type: str + mode: + description: + - Active mode, Manual or Auto(default). + default: Auto + choices: ['Auto', 'Manual'] + type: str + type: + description: + - Firmware type. + choices: ['BMC', 'BIOS'] + type: str + over_ride: + description: + - Reserve Configurations, 0-reserve, 1-override. + default: 0 + choices: [0, 1] + type: int + has_me: + description: + - Update me or not when update bios, only work in INTEL platform, 0-no, 1-yes. + - Only the M5 model supports this parameter. + default: 1 + choices: [0, 1] + type: int + dual_image: + description: + - Update dual image(default) or not. + - Only the M5 model supports this parameter. + default: dual + choices: ['single', 'dual'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Update fw test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "update bios" + kaytus.ksmanage.update_fw: + url: "/home/wbs/SA5112M5_BIOS_4.1.8_Standard_20200117.bin" + type: "BIOS" + provider: "{{ ksmanage }}" + + - name: "update bmc" + kaytus.ksmanage.update_fw: + url: "/home/wbs/SA5112M5_BMC_4.17.7_Standard_20200430" + mode: "Auto" + type: "BMC" + dual_image: "dual" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Update(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'fwupdate' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + url=dict(type='str', required=True), + mode=dict(type='str', default='Auto', choices=['Auto', 'Manual']), + over_ride=dict(type='int', default=0, choices=[0, 1]), + type=dict(type='str', required=False, choices=['BMC', 'BIOS']), + has_me=dict(type='int', default=1, choices=[0, 1]), + dual_image=dict(type='str', default='dual', choices=['single', 'dual']), + ) + argument_spec.update(ksmanage_argument_spec) + update_obj = Update(argument_spec) + update_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/update_psu.py b/ansible_collections/kaytus/ksmanage/plugins/modules/update_psu.py index 1e658dfcc..6aa58be2a 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/update_psu.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/update_psu.py @@ -1,117 +1,117 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: update_psu
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Update PSU
-description:
- - Update psu on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- url:
- description:
- - Firmware image url.
- required: true
- type: str
- mode:
- description:
- - Server Auto Reset Option, Manual or Auto(default).
- default: Auto
- choices: ['Auto', 'Manual']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Update psu test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "update psu"
- kaytus.ksmanage.update_psu:
- url: "/home/wbs/CRPS1300D2W_00.01.04_BootLoader_Pri_Sec.hpm"
- mode: "Auto"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Update(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'updatepsu'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- url=dict(type='str', required=True),
- mode=dict(type='str', default='Auto', choices=['Auto', 'Manual']),
- )
- argument_spec.update(ksmanage_argument_spec)
- update_obj = Update(argument_spec)
- update_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: update_psu +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Update PSU +description: + - Update psu on kaytus Server. +notes: + - Does not support C(check_mode). +options: + url: + description: + - Firmware image url. + required: true + type: str + mode: + description: + - Server Auto Reset Option, Manual or Auto(default). + default: Auto + choices: ['Auto', 'Manual'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Update psu test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "update psu" + kaytus.ksmanage.update_psu: + url: "/home/wbs/CRPS1300D2W_00.01.04_BootLoader_Pri_Sec.hpm" + mode: "Auto" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Update(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'updatepsu' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + url=dict(type='str', required=True), + mode=dict(type='str', default='Auto', choices=['Auto', 'Manual']), + ) + argument_spec.update(ksmanage_argument_spec) + update_obj = Update(argument_spec) + update_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/user.py b/ansible_collections/kaytus/ksmanage/plugins/modules/user.py index b193d23f7..be1c70d4d 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/user.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/user.py @@ -1,165 +1,165 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: user
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Manage user
-description:
- - Manage user on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- state:
- description:
- - Whether the user should exist or not, taking action if the state is different from what is stated.
- choices: ['present', 'absent']
- default: present
- type: str
- uid:
- description:
- - User id, The range is 1 to 16.
- type: int
- uname:
- description:
- - User name, Required when uid is None.
- type: str
- upass:
- description:
- - User password.
- type: str
- role_id:
- description:
- - User group.
- - Default user group 'Administrator', 'Operator', 'User'.
- - Use command C(user_group_info) can get all group information.
- type: str
- access:
- description:
- - User access.
- choices: ['enable', 'disable']
- type: str
- priv:
- description:
- - Other user permissions, select one or more from None/KVM/VMM/SOL.
- choices: ['kvm', 'vmm', 'sol', 'none']
- type: list
- elements: str
- email:
- description:
- - User email.
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: User test
- hosts: ksmanage
- no_log: true
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Add user"
- kaytus.ksmanage.user:
- state: "present"
- uname: "wbs"
- upass: "admin"
- role_id: "Administrator"
- priv: "kvm, sol"
- email: "wbs@ieisystem.com"
- provider: "{{ ksmanage }}"
-
- - name: "Set user"
- kaytus.ksmanage.user:
- state: "present"
- uname: "wbs"
- upass: "12345678"
- role_id: "user"
- priv: "kvm, sol"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class User(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'edituser'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- state=dict(type='str', choices=['present', 'absent'], default='present'),
- uid=dict(type='int', required=False),
- uname=dict(type='str', required=False),
- upass=dict(type='str', required=False, no_log=True),
- role_id=dict(type='str', required=False),
- access=dict(type='str', required=False, choices=['enable', 'disable']),
- priv=dict(type='list', elements='str', required=False, choices=['kvm', 'vmm', 'sol', 'none']),
- email=dict(type='str', required=False)
- )
- argument_spec.update(ksmanage_argument_spec)
- user_obj = User(argument_spec)
- user_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: user +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Manage user +description: + - Manage user on kaytus Server. +notes: + - Does not support C(check_mode). +options: + state: + description: + - Whether the user should exist or not, taking action if the state is different from what is stated. + choices: ['present', 'absent'] + default: present + type: str + uid: + description: + - User id, The range is 1 to 16. + type: int + uname: + description: + - User name, Required when uid is None. + type: str + upass: + description: + - User password. + type: str + role_id: + description: + - User group. + - Default user group 'Administrator', 'Operator', 'User'. + - Use command C(user_group_info) can get all group information. + type: str + access: + description: + - User access. + choices: ['enable', 'disable'] + type: str + priv: + description: + - Other user permissions, select one or more from None/KVM/VMM/SOL. + choices: ['kvm', 'vmm', 'sol', 'none'] + type: list + elements: str + email: + description: + - User email. + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: User test + hosts: ksmanage + no_log: true + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Add user" + kaytus.ksmanage.user: + state: "present" + uname: "wbs" + upass: "admin" + role_id: "Administrator" + priv: "kvm, sol" + email: "wbs@ieisystem.com" + provider: "{{ ksmanage }}" + + - name: "Set user" + kaytus.ksmanage.user: + state: "present" + uname: "wbs" + upass: "12345678" + role_id: "user" + priv: "kvm, sol" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class User(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'edituser' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + state=dict(type='str', choices=['present', 'absent'], default='present'), + uid=dict(type='int', required=False), + uname=dict(type='str', required=False), + upass=dict(type='str', required=False, no_log=True), + role_id=dict(type='str', required=False), + access=dict(type='str', required=False, choices=['enable', 'disable']), + priv=dict(type='list', elements='str', required=False, choices=['kvm', 'vmm', 'sol', 'none']), + email=dict(type='str', required=False) + ) + argument_spec.update(ksmanage_argument_spec) + user_obj = User(argument_spec) + user_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/user_group.py b/ansible_collections/kaytus/ksmanage/plugins/modules/user_group.py index c4f0e98fa..5237243ee 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/user_group.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/user_group.py @@ -1,204 +1,204 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: user_group
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Manage user group
-description:
- - Manage user group on kaytus Server.
-notes:
- - Does not support C(check_mode).
-options:
- state:
- description:
- - Whether the user group should exist or not, taking action if the state is different from what is stated.
- choices: ['present', 'absent']
- default: present
- type: str
- name:
- description:
- - Group name.
- - The range of group name for M6 model is OEM1, OEM2, OEM3, OEM4.
- required: true
- type: str
- pri:
- description:
- - Group privilege.
- - Required when I(state=present).
- - Only the M5 model supports this parameter.
- choices: ['administrator', 'operator', 'user', 'oem', 'none']
- type: str
- general:
- description:
- - General configuration privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- power:
- description:
- - Power control privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- media:
- description:
- - Remote media configuration privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- kvm:
- description:
- - Remote KVM configuration privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- security:
- description:
- - Security configuration privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- debug:
- description:
- - Debug diagnose privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
- self:
- description:
- - Itself configuration privilege.
- - Required when I(state=present).
- - Only the M6 model supports this parameter.
- choices: ['enable', 'disable']
- type: str
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: User group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Add user group"
- kaytus.ksmanage.user_group:
- state: "present"
- name: "test"
- pri: "administrator"
- provider: "{{ ksmanage }}"
-
- - name: "Set user group"
- kaytus.ksmanage.user_group:
- state: "present"
- name: "test"
- pri: "user"
- provider: "{{ ksmanage }}"
-
- - name: "Set m6 user group"
- kaytus.ksmanage.user_group:
- state: "present"
- name: "OEM1"
- general: "enable"
- kvm: "enable"
- provider: "{{ ksmanage }}"
-
- - name: "Delete user group"
- kaytus.ksmanage.user_group:
- state: "absent"
- name: "test"
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-from ansible.module_utils.basic import AnsibleModule
-
-
-class UserGroup(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=False)
-
- def run_command(self):
- self.module.params['subcommand'] = 'editusergroup'
- self.results = get_connection(self.module)
- if self.results['State'] == 'Success':
- self.results['changed'] = True
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict(
- state=dict(type='str', choices=['present', 'absent'], default='present'),
- name=dict(type='str', required=True),
- pri=dict(type='str', required=False, choices=['administrator', 'operator', 'user', 'oem', 'none']),
- general=dict(type='str', required=False, choices=['enable', 'disable']),
- power=dict(type='str', required=False, choices=['enable', 'disable']),
- media=dict(type='str', required=False, choices=['enable', 'disable']),
- kvm=dict(type='str', required=False, choices=['enable', 'disable']),
- security=dict(type='str', required=False, choices=['enable', 'disable']),
- debug=dict(type='str', required=False, choices=['enable', 'disable']),
- self=dict(type='str', required=False, choices=['enable', 'disable']),
- )
- argument_spec.update(ksmanage_argument_spec)
- usergroup_obj = UserGroup(argument_spec)
- usergroup_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: user_group +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Manage user group +description: + - Manage user group on kaytus Server. +notes: + - Does not support C(check_mode). +options: + state: + description: + - Whether the user group should exist or not, taking action if the state is different from what is stated. + choices: ['present', 'absent'] + default: present + type: str + name: + description: + - Group name. + - The range of group name for M6 model is OEM1, OEM2, OEM3, OEM4. + required: true + type: str + pri: + description: + - Group privilege. + - Required when I(state=present). + - Only the M5 model supports this parameter. + choices: ['administrator', 'operator', 'user', 'oem', 'none'] + type: str + general: + description: + - General configuration privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + power: + description: + - Power control privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + media: + description: + - Remote media configuration privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + kvm: + description: + - Remote KVM configuration privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + security: + description: + - Security configuration privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + debug: + description: + - Debug diagnose privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str + self: + description: + - Itself configuration privilege. + - Required when I(state=present). + - Only the M6 model supports this parameter. + choices: ['enable', 'disable'] + type: str +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: User group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Add user group" + kaytus.ksmanage.user_group: + state: "present" + name: "test" + pri: "administrator" + provider: "{{ ksmanage }}" + + - name: "Set user group" + kaytus.ksmanage.user_group: + state: "present" + name: "test" + pri: "user" + provider: "{{ ksmanage }}" + + - name: "Set m6 user group" + kaytus.ksmanage.user_group: + state: "present" + name: "OEM1" + general: "enable" + kvm: "enable" + provider: "{{ ksmanage }}" + + - name: "Delete user group" + kaytus.ksmanage.user_group: + state: "absent" + name: "test" + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) +from ansible.module_utils.basic import AnsibleModule + + +class UserGroup(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=False) + + def run_command(self): + self.module.params['subcommand'] = 'editusergroup' + self.results = get_connection(self.module) + if self.results['State'] == 'Success': + self.results['changed'] = True + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict( + state=dict(type='str', choices=['present', 'absent'], default='present'), + name=dict(type='str', required=True), + pri=dict(type='str', required=False, choices=['administrator', 'operator', 'user', 'oem', 'none']), + general=dict(type='str', required=False, choices=['enable', 'disable']), + power=dict(type='str', required=False, choices=['enable', 'disable']), + media=dict(type='str', required=False, choices=['enable', 'disable']), + kvm=dict(type='str', required=False, choices=['enable', 'disable']), + security=dict(type='str', required=False, choices=['enable', 'disable']), + debug=dict(type='str', required=False, choices=['enable', 'disable']), + self=dict(type='str', required=False, choices=['enable', 'disable']), + ) + argument_spec.update(ksmanage_argument_spec) + usergroup_obj = UserGroup(argument_spec) + usergroup_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/user_group_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/user_group_info.py index aa56c62a5..76b3ae1d4 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/user_group_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/user_group_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: user_group_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get user group information
-description:
- - Get user group information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: User group test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get user group information"
- kaytus.ksmanage.user_group_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class UserGroup(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getusergroup'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- usergroup_obj = UserGroup(argument_spec)
- usergroup_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: user_group_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get user group information +description: + - Get user group information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: User group test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get user group information" + kaytus.ksmanage.user_group_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class UserGroup(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getusergroup' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + usergroup_obj = UserGroup(argument_spec) + usergroup_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/user_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/user_info.py index a2069f990..369121eaf 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/user_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/user_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: user_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get user information
-description:
- - Get user information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: User test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get user information"
- kaytus.ksmanage.user_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class User(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getuser'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- user_obj = User(argument_spec)
- user_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: user_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get user information +description: + - Get user information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: User test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get user information" + kaytus.ksmanage.user_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class User(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getuser' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + user_obj = User(argument_spec) + user_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/virtual_media_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/virtual_media_info.py index 566bc6828..ebecfbede 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/virtual_media_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/virtual_media_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: virtual_media_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get Virtual Media information
-description:
- - Get Virtual Media information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Media test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get Virtual Media information"
- kaytus.ksmanage.virtual_media_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Media(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getvirtualmedia'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- media_obj = Media(argument_spec)
- media_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: virtual_media_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get Virtual Media information +description: + - Get Virtual Media information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Media test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get Virtual Media information" + kaytus.ksmanage.virtual_media_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Media(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getvirtualmedia' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + media_obj = Media(argument_spec) + media_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/kaytus/ksmanage/plugins/modules/volt_info.py b/ansible_collections/kaytus/ksmanage/plugins/modules/volt_info.py index 8207b75a3..2af7f93bf 100644 --- a/ansible_collections/kaytus/ksmanage/plugins/modules/volt_info.py +++ b/ansible_collections/kaytus/ksmanage/plugins/modules/volt_info.py @@ -1,99 +1,99 @@ -#!/usr/bin/python
-# -*- coding:utf-8 -*-
-
-# Copyright(C) 2023 Kaytus Inc. All Rights Reserved.
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import (absolute_import, division, print_function)
-
-__metaclass__ = type
-
-DOCUMENTATION = '''
----
-module: volt_info
-version_added: "1.0.0"
-author:
- - WangBaoshan (@ieisystem)
-short_description: Get volt information
-description:
- - Get volt information on kaytus Server.
-notes:
- - Supports C(check_mode).
-options: {}
-extends_documentation_fragment:
- - kaytus.ksmanage.ksmanage
-'''
-
-EXAMPLES = '''
-- name: Volt test
- hosts: ksmanage
- connection: local
- gather_facts: false
- vars:
- ksmanage:
- host: "{{ ansible_ssh_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
-
- tasks:
-
- - name: "Get volt information"
- kaytus.ksmanage.volt_info:
- provider: "{{ ksmanage }}"
-'''
-
-RETURN = '''
-message:
- description: Messages returned after module execution.
- returned: always
- type: str
-state:
- description: Status after module execution.
- returned: always
- type: str
-changed:
- description: Check to see if a change was made on the device.
- returned: always
- type: bool
-'''
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection)
-
-
-class Sensor(object):
- def __init__(self, argument_spec):
- self.spec = argument_spec
- self.module = None
- self.init_module()
- self.results = dict()
-
- def init_module(self):
- """Init module object"""
-
- self.module = AnsibleModule(
- argument_spec=self.spec, supports_check_mode=True)
-
- def run_command(self):
- self.module.params['subcommand'] = 'getvolt'
- self.results = get_connection(self.module)
-
- def show_result(self):
- """Show result"""
- self.module.exit_json(**self.results)
-
- def work(self):
- """Worker"""
- self.run_command()
- self.show_result()
-
-
-def main():
- argument_spec = dict()
- argument_spec.update(ksmanage_argument_spec)
- sensor_obj = Sensor(argument_spec)
- sensor_obj.work()
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright(C) 2023 Kaytus Inc. All Rights Reserved. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: volt_info +version_added: "1.0.0" +author: + - WangBaoshan (@ieisystem) +short_description: Get volt information +description: + - Get volt information on kaytus Server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - kaytus.ksmanage.ksmanage +''' + +EXAMPLES = ''' +- name: Volt test + hosts: ksmanage + connection: local + gather_facts: false + vars: + ksmanage: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get volt information" + kaytus.ksmanage.volt_info: + provider: "{{ ksmanage }}" +''' + +RETURN = ''' +message: + description: Messages returned after module execution. + returned: always + type: str +state: + description: Status after module execution. + returned: always + type: str +changed: + description: Check to see if a change was made on the device. + returned: always + type: bool +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanage import (ksmanage_argument_spec, get_connection) + + +class Sensor(object): + def __init__(self, argument_spec): + self.spec = argument_spec + self.module = None + self.init_module() + self.results = dict() + + def init_module(self): + """Init module object""" + + self.module = AnsibleModule( + argument_spec=self.spec, supports_check_mode=True) + + def run_command(self): + self.module.params['subcommand'] = 'getvolt' + self.results = get_connection(self.module) + + def show_result(self): + """Show result""" + self.module.exit_json(**self.results) + + def work(self): + """Worker""" + self.run_command() + self.show_result() + + +def main(): + argument_spec = dict() + argument_spec.update(ksmanage_argument_spec) + sensor_obj = Sensor(argument_spec) + sensor_obj.work() + + +if __name__ == '__main__': + main() |