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) 2013-2014, Christian Berendt <berendt@b1-systems.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Copyright (c) 2013-2014, Christian Berendt <berendt@b1-systems.de>
# 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
@@ -15,9 +16,16 @@ author:
- Christian Berendt (@berendt)
- Ralf Hertel (@n0trax)
- Robin Roth (@robinro)
short_description: Enables/disables a module of the Apache2 webserver.
short_description: Enables/disables a module of the Apache2 webserver
description:
- Enables or disables a specified module of the Apache2 webserver.
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: full
diff_mode:
support: none
options:
name:
type: str
@@ -29,14 +37,14 @@ options:
description:
- Identifier of the module as listed by C(apache2ctl -M).
This is optional and usually determined automatically by the common convention of
appending C(_module) to I(name) as well as custom exception for popular modules.
required: False
appending V(_module) to O(name) as well as custom exception for popular modules.
required: false
force:
description:
- Force disabling of default modules and override Debian warnings.
required: false
type: bool
default: False
default: false
state:
type: str
description:
@@ -47,7 +55,13 @@ options:
description:
- Ignore configuration checks about inconsistent module configuration. Especially for mpm_* modules.
type: bool
default: False
default: false
warn_mpm_absent:
description:
- Control the behavior of the warning process for MPM modules.
type: bool
default: true
version_added: 6.3.0
requirements: ["a2enmod","a2dismod"]
notes:
- This does not work on RedHat-based distributions. It does work on Debian- and SuSE-based distributions.
@@ -69,13 +83,25 @@ EXAMPLES = '''
community.general.apache2_module:
state: absent
name: autoindex
force: True
force: true
- name: Disable mpm_worker and ignore warnings about missing mpm module
community.general.apache2_module:
state: absent
name: mpm_worker
ignore_configcheck: True
ignore_configcheck: true
- name: Disable mpm_event, enable mpm_prefork and ignore warnings about missing mpm module
community.general.apache2_module:
name: "{{ item.module }}"
state: "{{ item.state }}"
warn_mpm_absent: false
ignore_configcheck: true
loop:
- module: mpm_event
state: absent
- module: mpm_prefork
state: present
- name: Enable dump_io module, which is identified as dumpio_module inside apache2
community.general.apache2_module:
@@ -128,7 +154,7 @@ def _get_ctl_binary(module):
if ctl_binary is not None:
return ctl_binary
module.fail_json(msg="Neither of apache2ctl nor apachctl found. At least one apache control binary is necessary.")
module.fail_json(msg="Neither of apache2ctl nor apachectl found. At least one apache control binary is necessary.")
def _module_is_enabled(module):
@@ -139,10 +165,11 @@ def _module_is_enabled(module):
error_msg = "Error executing %s: %s" % (control_binary, stderr)
if module.params['ignore_configcheck']:
if 'AH00534' in stderr and 'mpm_' in module.params['name']:
module.warnings.append(
"No MPM module loaded! apache2 reload AND other module actions"
" will fail if no MPM module is loaded immediately."
)
if module.params['warn_mpm_absent']:
module.warnings.append(
"No MPM module loaded! apache2 reload AND other module actions"
" will fail if no MPM module is loaded immediately."
)
else:
module.warnings.append(error_msg)
return False
@@ -248,6 +275,7 @@ def main():
force=dict(type='bool', default=False),
state=dict(default='present', choices=['absent', 'present']),
ignore_configcheck=dict(type='bool', default=False),
warn_mpm_absent=dict(type='bool', default=True),
),
supports_check_mode=True,
)