add_host

Collection: builtin

Full Name: add_host

Controller module — runs on the local controller, not on remote hosts.

Synopsis

Add a host to the in-memory inventory during a play

Parameters

NameTypeRequiredDefaultDescription
namestringyesThe hostname/IP of the host to add to the inventory
groupslistThe groups to add the hostname to
groupstringAlias for groups (for backward compatibility)

Example

- name: Register the newly provisioned host
  add_host:
    name: "{{ new_instance_ip }}"
    groups: webservers