Repository: ansible-collections/community.general

Issue:
Add support env variables for nmap inventory plugin
### Summary

hi there.

I have proposal for `community.general.nmap` dynamic  inventory plugin. 

I have cases when I need to use `.env` file for different tools such as: `docker-compose` and `ansible`.

Inside `.env` I store some configuration for my environment. I want use same file for configure different tools, but I can't use `lookup('ENV' SOME_ENV)` or `lookup('file', PATH/TO/SOME_FILE)` inside `inventory.yaml` to define network/CIDR for scan or exclude hosts.

I think, if plugin can define network/CIDR or exclude hosts for scan from environment variables then this will be solve some problems.

### Issue Type

Feature Idea

### Component Name

nmap

### Additional Information

```yaml
---
plugin: community.general.nmap
strict: false
ports: false
```

```bash
$ ansible-playbook -i inventory.yaml playbook.yaml
[WARNING]:  * Failed to parse /home/ev3k/INBOX/ansible/inventory.yaml with auto plugin: No setting was provided for required configuration plugin_type: inventory plugin:
ansible_collections.community.general.plugins.inventory.nmap setting: address
[WARNING]:  * Failed to parse /home/ev3k/INBOX/ansible/inventory.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse /home/ev3k/INBOX/ansible/inventory.yaml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a YAML file.
[WARNING]: Unable to parse /home/ev3k/INBOX/ansible/inventory.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Network Getting Started First Playbook] ****************************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************************************************************************************************************************
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/inventory/nmap.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/inventory/nmap.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->

Resolving patch:
diff --git a/plugins/inventory/nmap.py b/plugins/inventory/nmap.py
--- a/plugins/inventory/nmap.py
+++ b/plugins/inventory/nmap.py
@@ -30,10 +30,18 @@
         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)).


Test patch: