1#!/usr/local/bin/python3.8
2# -*- coding: utf-8 -*-
3
4# Copyright: (c) 2019, Thomas Moore (@tmmruk)
5# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7DOCUMENTATION = r'''
8---
9module: win_netbios
10short_description: Manage NetBIOS over TCP/IP settings on Windows.
11description:
12  - Enables or disables NetBIOS on Windows network adapters.
13  - Can be used to protect a system against NBT-NS poisoning and avoid NBNS broadcast storms.
14  - Settings can be applied system wide or per adapter.
15options:
16  state:
17    description:
18      - Whether NetBIOS should be enabled, disabled, or default (use setting from DHCP server or if static IP address is assigned enable NetBIOS).
19    choices:
20      - enabled
21      - disabled
22      - default
23    required: yes
24    type: str
25  adapter_names:
26    description:
27      - List of adapter names for which to manage NetBIOS settings. If this option is omitted then configuration is applied to all adapters on the system.
28      - The adapter name used is the connection caption in the Network Control Panel or via C(Get-NetAdapter), eg C(Ethernet 2).
29    type: list
30    elements: str
31    required: no
32
33author:
34  - Thomas Moore (@tmmruk)
35notes:
36  - Changing NetBIOS settings does not usually require a reboot and will take effect immediately.
37  - UDP port 137/138/139 will no longer be listening once NetBIOS is disabled.
38'''
39
40EXAMPLES = r'''
41- name: Disable NetBIOS system wide
42  community.windows.win_netbios:
43    state: disabled
44
45- name: Disable NetBIOS on Ethernet2
46  community.windows.win_netbios:
47    state: disabled
48    adapter_names:
49      - Ethernet2
50
51- name: Enable NetBIOS on Public and Backup adapters
52  community.windows.win_netbios:
53    state: enabled
54    adapter_names:
55      - Public
56      - Backup
57
58- name: Set NetBIOS to system default on all adapters
59  community.windows.win_netbios:
60    state: default
61'''
62
63RETURN = r'''
64reboot_required:
65    description: Boolean value stating whether a system reboot is required.
66    returned: always
67    type: bool
68    sample: true
69'''
70