community.general.nmap (8.5.0) — inventory

Uses nmap to find hosts to target

Authors: Unknown (!UNKNOWN)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Uses a YAML configuration file with a valid YAML extension.


Requirements

Inputs

    
ipv4:
    default: true
    description: use IPv4 type addresses
    type: boolean

ipv6:
    default: true
    description: use IPv6 type addresses
    type: boolean

open:
    default: false
    description: Only scan for open (or possibly open) ports.
    type: boolean
    version_added: 6.5.0
    version_added_collection: community.general

port:
    description:
    - Only scan specific port or port range (C(-p)).
    - For example, you could pass V(22) for a single port, V(1-65535) for a range of ports,
      or V(U:53,137,T:21-25,139,8080,S:9) to check port 53 with UDP, ports 21-25 with
      TCP, port 9 with SCTP, and ports 137, 139, and 8080 with all.
    type: string
    version_added: 6.5.0
    version_added_collection: community.general

sudo:
    default: false
    description: Set to V(true) to execute a C(sudo nmap) plugin scan.
    type: boolean
    version_added: 4.8.0
    version_added_collection: community.general

cache:
    default: false
    description:
    - Toggle to enable/disable the caching of the inventory's source data, requires a
      cache plugin setup to work.
    env:
    - name: ANSIBLE_INVENTORY_CACHE
    ini:
    - key: cache
      section: inventory
    type: bool

ports:
    default: true
    description: Enable/disable scanning ports.
    type: boolean

groups:
    default: {}
    description: Add hosts to group based on Jinja2 conditionals.
    type: dict

plugin:
    choices:
    - nmap
    - community.general.nmap
    description: token that ensures this is a source file for the 'nmap' plugin.
    required: true

strict:
    default: false
    description:
    - If V(yes) make invalid entries a fatal error, otherwise skip and continue.
    - Since it is possible to use facts in the expressions they might not always be available
      and we ignore those errors by default.
    type: bool

address:
    description: Network IP or range of IPs to scan, you can use a simple range (10.2.2.15-25)
      or CIDR notation.
    env:
    - name: ANSIBLE_NMAP_ADDRESS
      version_added: 6.6.0
      version_added_collection: community.general
    required: true

compose:
    default: {}
    description: Create vars from jinja2 expressions.
    type: dict

exclude:
    description:
    - List of addresses to exclude.
    - For example V(10.2.2.15-25) or V(10.2.2.15,10.2.2.16).
    elements: string
    env:
    - name: ANSIBLE_NMAP_EXCLUDE
      version_added: 6.6.0
      version_added_collection: community.general
    type: list

udp_scan:
    default: false
    description:
    - Scan via UDP.
    - Depending on your system you might need O(sudo=true) for this to work.
    type: boolean
    version_added: 6.1.0
    version_added_collection: community.general

dns_resolve:
    default: false
    description: Whether to always (V(true)) or never (V(false)) do DNS resolution.
    type: boolean
    version_added: 6.1.0
    version_added_collection: community.general

cache_plugin:
    default: memory
    description:
    - Cache plugin to use for the inventory's source data.
    env:
    - name: ANSIBLE_CACHE_PLUGIN
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN
    ini:
    - key: fact_caching
      section: defaults
    - key: cache_plugin
      section: inventory
    type: str

cache_prefix:
    default: ansible_inventory_
    description:
    - Prefix to use for cache plugin files/tables
    env:
    - name: ANSIBLE_CACHE_PLUGIN_PREFIX
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
    ini:
    - key: fact_caching_prefix
      section: defaults
    - key: cache_prefix
      section: inventory

keyed_groups:
    default: []
    description: Add hosts to group based on the values of a variable.
    elements: dict
    suboptions:
      default_value:
        description:
        - The default value when the host variable's value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].trailing_separator).
        type: str
        version_added: '2.12'
        version_added_collection: ansible.builtin
      key:
        description:
        - The key from input dictionary used to generate groups
        type: str
      parent_group:
        description: parent group for keyed group
        type: str
      prefix:
        default: ''
        description: A keyed group name will start with this prefix
        type: str
      separator:
        default: _
        description: separator used to build the keyed group name
        type: str
      trailing_separator:
        default: true
        description:
        - Set this option to V(False) to omit the O(keyed_groups[].separator) after the
          host variable when the value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].default_value).
        type: bool
        version_added: '2.12'
        version_added_collection: ansible.builtin
    type: list

use_arp_ping:
    default: true
    description: Whether to always (V(true)) use the quick ARP ping or (V(false)) a slower
      but more reliable method.
    type: boolean
    version_added: 7.4.0
    version_added_collection: community.general

cache_timeout:
    default: 3600
    description:
    - Cache duration in seconds
    env:
    - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
    - name: ANSIBLE_INVENTORY_CACHE_TIMEOUT
    ini:
    - key: fact_caching_timeout
      section: defaults
    - key: cache_timeout
      section: inventory
    type: int

icmp_timestamp:
    default: false
    description:
    - Scan via ICMP Timestamp (C(-PP)).
    - Depending on your system you might need O(sudo=true) for this to work.
    type: boolean
    version_added: 6.1.0
    version_added_collection: community.general

use_extra_vars:
    default: false
    description: Merge extra vars into the available variables for composition (highest
      precedence).
    env:
    - name: ANSIBLE_INVENTORY_USE_EXTRA_VARS
    ini:
    - key: use_extra_vars
      section: inventory_plugins
    type: bool
    version_added: '2.11'
    version_added_collection: ansible.builtin

cache_connection:
    description:
    - Cache connection data or path, read cache plugin documentation for specifics.
    env:
    - name: ANSIBLE_CACHE_PLUGIN_CONNECTION
    - name: ANSIBLE_INVENTORY_CACHE_CONNECTION
    ini:
    - key: fact_caching_connection
      section: defaults
    - key: cache_connection
      section: inventory
    type: str

leading_separator:
    default: true
    description:
    - Use in conjunction with keyed_groups.
    - By default, a keyed group that does not have a prefix or a separator provided will
      have a name that starts with an underscore.
    - This is because the default prefix is "" and the default separator is "_".
    - Set this option to False to omit the leading underscore (or other separator) if
      no prefix is given.
    - If the group name is derived from a mapping the separator is still used to concatenate
      the items.
    - To not use a separator in the group name at all, set the separator for the keyed
      group to an empty string instead.
    type: boolean
    version_added: '2.11'
    version_added_collection: ansible.builtin