diff options
Diffstat (limited to 'ansible_collections/inspur/ispim/plugins/modules')
5 files changed, 250 insertions, 14 deletions
diff --git a/ansible_collections/inspur/ispim/plugins/modules/add_ldisk.py b/ansible_collections/inspur/ispim/plugins/modules/add_ldisk.py index 9abe7bb22..02124b833 100644 --- a/ansible_collections/inspur/ispim/plugins/modules/add_ldisk.py +++ b/ansible_collections/inspur/ispim/plugins/modules/add_ldisk.py @@ -28,7 +28,7 @@ options: ctrl_id: description: - Raid controller ID. - - Required when I(Info=None) and controller type is LSI or PMC. + - Required when I(Info=None) and controller type is LSI,PMC or MV. type: int level: description: @@ -38,9 +38,11 @@ options: type: int size: description: - - Strip Size, 1 - 64k, 2 - 128k, 3 - 256k, 4 - 512k, 5 - 1024k. - - Required when I(Info=None) and controller type is LSI or PMC. - choices: [1, 2, 3, 4, 5] + - 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: @@ -56,7 +58,7 @@ options: type: int w: description: - - Write Policy, 1 - Write Throgh, 2 - Write Back, 3 - Write caching ok if bad BBU. + - Write Policy, 1 - Write Through, 2 - Write Back, 3 - Write caching ok if bad BBU. - Required when I(Info=None) and controller type is LSI. choices: [1, 2, 3] type: int @@ -99,6 +101,7 @@ options: description: - Virtual drive name. - Required when I(Info=None) and controller type is PMC or server model is M7. + - Required when I(Info=None) and controller type is MV. type: str extends_documentation_fragment: - inspur.ispim.ism @@ -122,7 +125,7 @@ EXAMPLES = ''' info: "show" provider: "{{ ism }}" - - name: "Add ldisk" + - name: "Add LSI ldisk" inspur.ispim.add_ldisk: ctrl_id: 0 level: 1 @@ -137,7 +140,7 @@ EXAMPLES = ''' slot: 0,1 provider: "{{ ism }}" - - name: "Add PMC ldisk" + - name: "Add PMC ldisk" inspur.ispim.add_ldisk: ctrl_id: 0 level: 1 @@ -146,6 +149,13 @@ EXAMPLES = ''' slot: 0,1 vname: "test" provider: "{{ ism }}" + + - name: "Add MV ldisk" + inspur.ispim.add_ldisk: + ctrl_id: 0 + size: 1 + vname: "test" + provider: "{{ ism }}" ''' RETURN = ''' @@ -201,7 +211,7 @@ def main(): info=dict(type='str', required=False, choices=['show']), 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=[1, 2, 3, 4, 5]), + 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]), diff --git a/ansible_collections/inspur/ispim/plugins/modules/edit_bios.py b/ansible_collections/inspur/ispim/plugins/modules/edit_bios.py index d1175644f..c9185fc16 100644 --- a/ansible_collections/inspur/ispim/plugins/modules/edit_bios.py +++ b/ansible_collections/inspur/ispim/plugins/modules/edit_bios.py @@ -20,15 +20,20 @@ description: 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(file_url=None). + - Required when I(list=False) and I(file_url=None). type: str value: description: - BIOS setup option value. - - Required when I(file_url=None). + - Required when I(list=False) and I(file_url=None). type: str file_url: description: @@ -115,6 +120,7 @@ class BIOS(object): 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) diff --git a/ansible_collections/inspur/ispim/plugins/modules/edit_smtp_com.py b/ansible_collections/inspur/ispim/plugins/modules/edit_smtp_com.py index 85bf93b2f..4965ec6c5 100644 --- a/ansible_collections/inspur/ispim/plugins/modules/edit_smtp_com.py +++ b/ansible_collections/inspur/ispim/plugins/modules/edit_smtp_com.py @@ -78,18 +78,22 @@ options: 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: - inspur.ispim.ism @@ -186,10 +190,10 @@ def main(): 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), - serial_number=dict(type='str', required=False), - asset_tag=dict(type='str', required=False), - event_level=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(ism_argument_spec) smtp_obj = SMTP(argument_spec) diff --git a/ansible_collections/inspur/ispim/plugins/modules/hba_info.py b/ansible_collections/inspur/ispim/plugins/modules/hba_info.py new file mode 100644 index 000000000..ccb11cb11 --- /dev/null +++ b/ansible_collections/inspur/ispim/plugins/modules/hba_info.py @@ -0,0 +1,99 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright (C) 2020 Inspur 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: "2.1.0" +author: + - WangBaoshan (@ispim) +short_description: Get CPU information +description: + - Get HBA information on Inspur server. +notes: + - Supports C(check_mode). +options: {} +extends_documentation_fragment: + - inspur.ispim.ism +''' + +EXAMPLES = ''' +- name: HBA test + hosts: ism + connection: local + gather_facts: no + vars: + ism: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "Get hba information" + inspur.ispim.hba_info: + provider: "{{ ism }}" +''' + +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.inspur.ispim.plugins.module_utils.ism import (ism_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(ism_argument_spec) + hba_obj = HBA(argument_spec) + hba_obj.work() + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/inspur/ispim/plugins/modules/update_psu.py b/ansible_collections/inspur/ispim/plugins/modules/update_psu.py new file mode 100644 index 000000000..94929d326 --- /dev/null +++ b/ansible_collections/inspur/ispim/plugins/modules/update_psu.py @@ -0,0 +1,117 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- + +# Copyright (C) 2020 Inspur 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: "2.0.0" +author: + - WangBaoshan (@ispim) +short_description: Update PSU +description: + - Update psu on Inspur 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: + - inspur.ispim.ism +''' + +EXAMPLES = ''' +- name: Update psu test + hosts: ism + connection: local + gather_facts: no + vars: + ism: + host: "{{ ansible_ssh_host }}" + username: "{{ username }}" + password: "{{ password }}" + + tasks: + + - name: "update psu" + inspur.ispim.update_psu: + url: "/home/wbs/CRPS1300D2W_00.01.04_BootLoader_Pri_Sec.hpm" + mode: "Auto" + provider: "{{ ism }}" +''' + +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.inspur.ispim.plugins.module_utils.ism import (ism_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(ism_argument_spec) + update_obj = Update(argument_spec) + update_obj.work() + + +if __name__ == '__main__': + main() |