diff --git a/changelogs/fragments/6351-support-env-variables-to-nmap-dynamic-inventoiry.yaml b/changelogs/fragments/6351-support-env-variables-to-nmap-dynamic-inventoiry.yaml new file mode 100644 index 0000000000..043f725387 --- /dev/null +++ b/changelogs/fragments/6351-support-env-variables-to-nmap-dynamic-inventoiry.yaml @@ -0,0 +1,2 @@ +minor_changes: + - nmap inventory plugin - added environment variables for configure ``address`` and ``exclude`` (https://github.com/ansible-collections/community.general/issues/6351). diff --git a/plugins/inventory/nmap.py b/plugins/inventory/nmap.py index 621f047577..a03cf3e6fa 100644 --- a/plugins/inventory/nmap.py +++ b/plugins/inventory/nmap.py @@ -30,10 +30,18 @@ DOCUMENTATION = ''' address: description: Network IP or range of IPs to scan, you can use a simple range (10.2.2.15-25) or CIDR notation. required: true + env: + - name: ANSIBLE_NMAP_ADDRESS + version_added: 6.6.0 exclude: - description: list of addresses to exclude + description: + - List of addresses to exclude. + - For example C(10.2.2.15-25) or C(10.2.2.15,10.2.2.16). type: list elements: string + env: + - name: ANSIBLE_NMAP_EXCLUDE + version_added: 6.6.0 port: description: - Only scan specific port or port range (C(-p)).