| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
# Copyright (c) 2020, Nikolay Dachev <[email protected]> |
| 4 |
# GNU General Public License v3.0+ https://www.gnu.org/licenses/gpl-3.0.txt |
| 5 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 6 |
|
| 7 |
from __future__ import (absolute_import, division, print_function) |
| 8 |
__metaclass__ = type |
| 9 |
|
| 10 |
|
| 11 |
class ModuleDocFragment(object): |
| 12 |
|
| 13 |
DOCUMENTATION = r""" |
| 14 |
options: |
| 15 |
hostname: |
| 16 |
description: |
| 17 |
- RouterOS hostname API. |
| 18 |
required: true |
| 19 |
type: str |
| 20 |
username: |
| 21 |
description: |
| 22 |
- RouterOS login user. |
| 23 |
required: true |
| 24 |
type: str |
| 25 |
password: |
| 26 |
description: |
| 27 |
- RouterOS user password. |
| 28 |
required: true |
| 29 |
type: str |
| 30 |
timeout: |
| 31 |
description: |
| 32 |
- Timeout for the request. |
| 33 |
type: int |
| 34 |
default: 10 |
| 35 |
version_added: 2.3.0 |
| 36 |
tls: |
| 37 |
description: |
| 38 |
- If is set TLS will be used for RouterOS API connection. |
| 39 |
required: false |
| 40 |
type: bool |
| 41 |
default: false |
| 42 |
aliases: |
| 43 |
- ssl |
| 44 |
port: |
| 45 |
description: |
| 46 |
- RouterOS API port. If O(tls) is set, port will apply to TLS/SSL connection. |
| 47 |
- Defaults are V(8728) for the HTTP API, and V(8729) for the HTTPS API. |
| 48 |
type: int |
| 49 |
force_no_cert: |
| 50 |
description: |
| 51 |
- Set to V(true) to connect without a certificate when O(tls=true). |
| 52 |
- See also O(validate_certs). |
| 53 |
- B(Note:) this forces the use of anonymous Diffie-Hellman (ADH) ciphers. The protocol is susceptible to Man-in-the-Middle |
| 54 |
attacks, because the keys used in the exchange are not authenticated. Instead of simply connecting without a certificate |
| 55 |
to "make things work" have a look at O(validate_certs) and O(ca_path). |
| 56 |
type: bool |
| 57 |
default: false |
| 58 |
version_added: 2.4.0 |
| 59 |
validate_certs: |
| 60 |
description: |
| 61 |
- Set to V(false) to skip validation of TLS certificates. |
| 62 |
- See also O(validate_cert_hostname). Only used when O(tls=true). |
| 63 |
- B(Note:) instead of simply deactivating certificate validations to "make things work", please consider creating your |
| 64 |
own CA certificate and using it to sign certificates used for your router. You can tell the module about your CA certificate |
| 65 |
with the O(ca_path) option. |
| 66 |
type: bool |
| 67 |
default: true |
| 68 |
version_added: 1.2.0 |
| 69 |
validate_cert_hostname: |
| 70 |
description: |
| 71 |
- Set to V(true) to validate hostnames in certificates. |
| 72 |
- See also O(validate_certs). Only used when O(tls=true) and O(validate_certs=true). |
| 73 |
type: bool |
| 74 |
default: false |
| 75 |
version_added: 1.2.0 |
| 76 |
ca_path: |
| 77 |
description: |
| 78 |
- PEM formatted file that contains a CA certificate to be used for certificate validation. |
| 79 |
- See also O(validate_cert_hostname). Only used when O(tls=true) and O(validate_certs=true). |
| 80 |
type: path |
| 81 |
version_added: 1.2.0 |
| 82 |
encoding: |
| 83 |
description: |
| 84 |
- Use the specified encoding when communicating with the RouterOS device. |
| 85 |
- Default is V(ASCII). Note that V(UTF-8) requires librouteros 3.2.1 or newer. |
| 86 |
type: str |
| 87 |
default: ASCII |
| 88 |
version_added: 2.1.0 |
| 89 |
requirements: |
| 90 |
- librouteros |
| 91 |
- Python >= 3.6 (for librouteros) |
| 92 |
seealso: |
| 93 |
- ref: ansible_collections.community.routeros.docsite.api-guide |
| 94 |
description: How to connect to RouterOS devices with the RouterOS API. |
| 95 |
""" |
| 96 |
|
| 97 |
RESTRICT = r""" |
| 98 |
options: |
| 99 |
restrict: |
| 100 |
type: list |
| 101 |
elements: dict |
| 102 |
suboptions: |
| 103 |
field: |
| 104 |
description: |
| 105 |
- The field whose values to restrict. |
| 106 |
required: true |
| 107 |
type: str |
| 108 |
match_disabled: |
| 109 |
description: |
| 110 |
- Whether disabled or not provided values should match. |
| 111 |
type: bool |
| 112 |
default: false |
| 113 |
values: |
| 114 |
description: |
| 115 |
- The values of the field to limit to. |
| 116 |
- 'Note that the types of the values are important. If you provide a string V("0"), and librouteros converts the |
| 117 |
value returned by the API to the integer V(0), then this will not match. If you are not sure, better include both |
| 118 |
variants: both the string and the integer.' |
| 119 |
type: list |
| 120 |
elements: raw |
| 121 |
regex: |
| 122 |
description: |
| 123 |
- A regular expression matching values of the field to limit to. |
| 124 |
- Note that all values will be converted to strings before matching. |
| 125 |
- It is not possible to match disabled values with regular expressions. Set O(restrict[].match_disabled=true) if |
| 126 |
you also want to match disabled values. |
| 127 |
type: str |
| 128 |
invert: |
| 129 |
description: |
| 130 |
- Invert the condition. This affects O(restrict[].match_disabled), O(restrict[].values), and O(restrict[].regex). |
| 131 |
type: bool |
| 132 |
default: false |
| 133 |
""" |