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

@@ -3,7 +3,9 @@
# This module is proudly sponsored by CGI (www.cgi.com) and
# KPN (www.kpn.com).
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Copyright (c) Ansible project
# 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
@@ -17,6 +19,11 @@ description:
- "Add or remove a host to Icinga2 through the API."
- "See U(https://www.icinga.com/docs/icinga2/latest/doc/12-icinga2-api/)"
author: "Jurgen Brand (@t794104)"
attributes:
check_mode:
support: full
diff_mode:
support: none
options:
url:
type: str
@@ -24,26 +31,26 @@ options:
- HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path
use_proxy:
description:
- If C(no), it will not use a proxy, even if one is defined in
- If V(false), it will not use a proxy, even if one is defined in
an environment variable on the target hosts.
type: bool
default: 'yes'
default: true
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
- If V(false), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
type: bool
default: 'yes'
default: true
url_username:
type: str
description:
- The username for use in HTTP basic authentication.
- This parameter can be used without C(url_password) for sites that allow empty passwords.
- This parameter can be used without O(url_password) for sites that allow empty passwords.
url_password:
type: str
description:
- The password for use in HTTP basic authentication.
- If the C(url_username) parameter is not specified, the C(url_password) parameter will not be used.
- If the O(url_username) parameter is not specified, the O(url_password) parameter will not be used.
force_basic_auth:
description:
- httplib2, the library used by the uri module only sends authentication information when a webservice
@@ -51,18 +58,18 @@ options:
send a 401, logins will fail. This option forces the sending of the Basic authentication header
upon initial request.
type: bool
default: 'no'
default: false
client_cert:
type: path
description:
- PEM formatted certificate chain file to be used for SSL client
authentication. This file can also include the key as well, and if
the key is included, C(client_key) is not required.
the key is included, O(client_key) is not required.
client_key:
type: path
description:
- PEM formatted file that contains your private key to be used for SSL
client authentication. If C(client_cert) contains both the certificate
client authentication. If O(client_cert) contains both the certificate
and key, this option is not required.
state:
type: str
@@ -94,18 +101,19 @@ options:
type: str
description:
- The name used to display the host.
- If not specified, it defaults to the value of the I(name) parameter.
- If not specified, it defaults to the value of the O(name) parameter.
ip:
type: str
description:
- The IP address of the host.
required: true
- This is no longer required since community.general 8.0.0.
variables:
type: dict
description:
- Dictionary of variables.
extends_documentation_fragment:
- url
- ansible.builtin.url
- community.general.attributes
'''
EXAMPLES = '''
@@ -134,7 +142,6 @@ data:
'''
import json
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url, url_argument_spec
@@ -236,7 +243,7 @@ def main():
template=dict(default=None),
check_command=dict(default="hostalive"),
display_name=dict(default=None),
ip=dict(required=True),
ip=dict(),
variables=dict(type='dict', default=None),
)
@@ -249,9 +256,9 @@ def main():
state = module.params["state"]
name = module.params["name"]
zone = module.params["zone"]
template = [name]
template = []
if module.params["template"]:
template.append(module.params["template"])
template = [module.params["template"]]
check_command = module.params["check_command"]
ip = module.params["ip"]
display_name = module.params["display_name"]
@@ -266,20 +273,18 @@ def main():
module.fail_json(msg="unable to connect to Icinga. Exception message: %s" % (e))
data = {
'templates': template,
'attrs': {
'address': ip,
'display_name': display_name,
'check_command': check_command,
'zone': zone,
'vars': {
'made_by': "ansible",
},
'templates': template,
'vars.made_by': "ansible"
}
}
if variables:
data['attrs']['vars'].update(variables)
for key, value in variables.items():
data['attrs']['vars.' + key] = value
changed = False
if icinga.exists(name):
@@ -301,7 +306,7 @@ def main():
module.exit_json(changed=False, name=name, data=data)
# Template attribute is not allowed in modification
del data['attrs']['templates']
del data['templates']
ret = icinga.modify(name, data)