Install, inventory & ad-hoc commands
Hosts, groups, and one-off tasks.
Ansible installs as a Python package on the control node only — pip install ansible, and you are ready; the managed hosts get nothing. The first thing you define is inventory: a list of the hosts you manage, organized into groups (webservers, dbservers) so you can target them collectively. Inventory can be a simple INI or YAML file to start, and later a dynamic source that queries your cloud.
[web]web1.acme.internalweb2.acme.internal[db]db1.acme.internal[prod:children] # a group of groupswebdb[web:vars]ansible_user=deploy
Ad-hoc commands
Before playbooks, the quickest way to use Ansible is an ad-hoc command: run a single module against a group right now. ansible <group> -m <module> -a <args> is perfect for one-off tasks — check connectivity with the ping module, gather uptime, restart a service across a group. It is the same execution engine as a playbook, just one task instead of a file of them.
$ ansible web -i inventory.ini -m pingweb1.acme.internal | SUCCESS => { "ping": "pong" }web2.acme.internal | SUCCESS => { "ping": "pong" }$ ansible web -i inventory.ini -m service -a "name=nginx state=restarted" --become