Skip to content

Instantly share code, notes, and snippets.

@alces
Last active June 3, 2025 22:54
Show Gist options
  • Save alces/caa3e7e5f46f9595f715f0f55eef65c1 to your computer and use it in GitHub Desktop.
Save alces/caa3e7e5f46f9595f715f0f55eef65c1 to your computer and use it in GitHub Desktop.
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
  • using Ansible configuration file:
[defaults]
transport = local
  • using playbook header:
- hosts: 127.0.0.1
  connection: local
@aiai97
Copy link

aiai97 commented Apr 27, 2025

Thanks a lot, this is so annoying to figure out!

cannot agree more~~

@christianmlong
Copy link

Here's a way to list the Ansible facts on the local machine

ansible 127.0.0.1 -m ansible.builtin.setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment