mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 05:34:22 -07:00
Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
220bb72d6c
commit
cfd1167ee8
1 changed files with 19 additions and 26 deletions
|
@ -9,14 +9,13 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
|
||||||
module: pacemaker_stonith
|
module: pacemaker_stonith
|
||||||
short_description: Manage pacemaker STONITH
|
short_description: Manage pacemaker STONITH
|
||||||
author:
|
author:
|
||||||
- Dexter Le (@munchtoast)
|
- Dexter Le (@munchtoast)
|
||||||
version_added: 11.1.0
|
version_added: 11.1.0
|
||||||
description:
|
description:
|
||||||
- This module can manage STONITH in a Pacemaker cluster using the pacemaker CLI.
|
- This module manages STONITH in a Pacemaker cluster using the pacemaker CLI.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -38,7 +37,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
stonith_type:
|
stonith_type:
|
||||||
description:
|
description:
|
||||||
- Specify the STONITH device type
|
- Specify the STONITH device type.
|
||||||
type: str
|
type: str
|
||||||
stonith_options:
|
stonith_options:
|
||||||
description:
|
description:
|
||||||
|
@ -59,12 +58,12 @@ options:
|
||||||
type: str
|
type: str
|
||||||
operation_options:
|
operation_options:
|
||||||
description:
|
description:
|
||||||
- Operation option to associate with action.
|
- Operation options to associate with action.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
stonith_metas:
|
stonith_metas:
|
||||||
description:
|
description:
|
||||||
- List of meta to associate with STONITH.
|
- List of metadata to associate with STONITH.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
stonith_argument:
|
stonith_argument:
|
||||||
|
@ -84,7 +83,7 @@ options:
|
||||||
elements: str
|
elements: str
|
||||||
agent_validation:
|
agent_validation:
|
||||||
description:
|
description:
|
||||||
- enabled agent validation for STONITH creation.
|
- Enabled agent validation for STONITH creation.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
wait:
|
wait:
|
||||||
|
@ -95,22 +94,17 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
---
|
- name: Create virtual-ip STONITH
|
||||||
- name: Create pacemaker STONITH
|
community.general.pacemaker_stonith:
|
||||||
hosts: localhost
|
state: present
|
||||||
gather_facts: false
|
name: virtual-stonith
|
||||||
tasks:
|
stonith_type: fence_virt
|
||||||
- name: Create virtual-ip STONITH
|
stonith_options:
|
||||||
community.general.pacemaker_stonith:
|
- "pcmk_host_list=f1"
|
||||||
state: present
|
stonith_operations:
|
||||||
name: virtual-stonith
|
- operation_action: monitor
|
||||||
stonith_type: fence_virt
|
operation_options:
|
||||||
stonith_options:
|
- "interval=30s"
|
||||||
- "pcmk_host_list=f1"
|
|
||||||
stonith_operations:
|
|
||||||
- operation_action: monitor
|
|
||||||
operation_options:
|
|
||||||
- "interval=30s"
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
@ -132,8 +126,8 @@ class PacemakerStonith(StateModuleHelper):
|
||||||
'present', 'absent', 'enabled', 'disabled']),
|
'present', 'absent', 'enabled', 'disabled']),
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
stonith_type=dict(type='str'),
|
stonith_type=dict(type='str'),
|
||||||
stonith_options=dict(type='list', elements='str', default=list()),
|
stonith_options=dict(type='list', elements='str', default=[]),
|
||||||
stonith_operations=dict(type='list', elements='dict', default=list(), options=dict(
|
stonith_operations=dict(type='list', elements='dict', default=[], options=dict(
|
||||||
operation_action=dict(type='str'),
|
operation_action=dict(type='str'),
|
||||||
operation_options=dict(type='list', elements='str'),
|
operation_options=dict(type='list', elements='str'),
|
||||||
)),
|
)),
|
||||||
|
@ -149,7 +143,6 @@ class PacemakerStonith(StateModuleHelper):
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
use_old_vardict = False
|
|
||||||
default_state = "present"
|
default_state = "present"
|
||||||
|
|
||||||
def __init_module__(self):
|
def __init_module__(self):
|
||||||
|
@ -177,7 +170,7 @@ class PacemakerStonith(StateModuleHelper):
|
||||||
modified_stonith_operations = []
|
modified_stonith_operations = []
|
||||||
for stonith_operation in self.vars.stonith_operations:
|
for stonith_operation in self.vars.stonith_operations:
|
||||||
modified_stonith_operations.append(dict([("operation_action", stonith_operation.get('operation_action')),
|
modified_stonith_operations.append(dict([("operation_action", stonith_operation.get('operation_action')),
|
||||||
("operation_option", stonith_operation.get('operation_options'))]))
|
("operation_option", stonith_operation.get('operation_options'))]))
|
||||||
return modified_stonith_operations
|
return modified_stonith_operations
|
||||||
|
|
||||||
def state_absent(self):
|
def state_absent(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue