ansible.builtin.host_list – Parses a ‘host list’ string
Note
This inventory plugin is part of ansible-core
and included in all Ansible installations. In most cases, you can use the short plugin name host_list
even without specifying the collections:
keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
Synopsis
- Parses a host list string as a comma separated values of hosts
- This plugin only applies to inventory strings that are not paths and contain a comma.
Examples
# define 2 hosts in command line # ansible -i '10.10.2.6, 10.10.2.4' -m ping all # DNS resolvable names # ansible -i 'host1.example.com, host2' -m user -a 'name=me state=absent' all # just use localhost # ansible-playbook -i 'localhost,' play.yml -c local
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/host_list_inventory.html