collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -1,8 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Copyright (c) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
@@ -14,30 +15,40 @@ module: hponcfg
author: Dag Wieers (@dagwieers)
short_description: Configure HP iLO interface using hponcfg
description:
- This modules configures the HP iLO interface using hponcfg.
- This modules configures the HP iLO interface using hponcfg.
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: none
diff_mode:
support: none
options:
path:
description:
- The XML file as accepted by hponcfg.
- The XML file as accepted by hponcfg.
required: true
aliases: ['src']
type: path
minfw:
description:
- The minimum firmware level needed.
- The minimum firmware level needed.
required: false
type: str
executable:
description:
- Path to the hponcfg executable (`hponcfg` which uses $PATH).
- Path to the hponcfg executable (C(hponcfg) which uses $PATH).
default: hponcfg
type: str
verbose:
description:
- Run hponcfg in verbose mode (-v).
default: no
- Run hponcfg in verbose mode (-v).
default: false
type: bool
requirements:
- hponcfg tool
- hponcfg tool
notes:
- You need a working hponcfg on the target system.
- You need a working hponcfg on the target system.
'''
EXAMPLES = r'''
@@ -69,12 +80,11 @@ EXAMPLES = r'''
executable: /opt/hp/tools/hponcfg
'''
from ansible_collections.community.general.plugins.module_utils.module_helper import (
CmdModuleHelper, ArgFormat
)
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
class HPOnCfg(CmdModuleHelper):
class HPOnCfg(ModuleHelper):
module = dict(
argument_spec=dict(
src=dict(type='path', required=True, aliases=['path']),
@@ -84,19 +94,22 @@ class HPOnCfg(CmdModuleHelper):
)
)
command_args_formats = dict(
src=dict(fmt=["-f", "{0}"]),
verbose=dict(fmt="-v", style=ArgFormat.BOOLEAN),
minfw=dict(fmt=["-m", "{0}"]),
src=cmd_runner_fmt.as_opt_val("-f"),
verbose=cmd_runner_fmt.as_bool("-v"),
minfw=cmd_runner_fmt.as_opt_val("-m"),
)
check_rc = True
def __init_module__(self):
self.command = self.vars.executable
# Consider every action a change (not idempotent yet!)
self.changed = True
def __run__(self):
self.run_command(params=['src', 'verbose', 'minfw'])
runner = CmdRunner(
self.module,
self.vars.executable,
self.command_args_formats,
check_rc=True,
)
runner(['src', 'verbose', 'minfw']).run()
# Consider every action a change (not idempotent yet!)
self.changed = True
def main():