Experiment with Ansible on localhost

Prepare a YAML-based inventory file

examples/ansible/localhost/inventory.yml

all:
  hosts:
    127.0.0.1:

Create an Ansible configuration file

Telling Ansible where the inventory is.

examples/ansible/localhost/ansible.cfg

[defaults]
deprecation_warnings = False
inventory = inventory.yml
host_key_checking = False
#ask_pass = True

Make sure you can ssh to localhost:

cd ~/.ssh
cat id_rsa.pub >> authorized_keys

Then you can start running commands:

ansible all -m ping
ansible all -m ping