Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@k-popov

This comment has been minimized.

Copy link

k-popov commented Oct 15, 2018

The first option only works as ansible-playbook --connection=local --inventory 127.0.0.1, playbook.yml
Comma is essential, otherwise it's treated like file name.

@andreasneuber

This comment has been minimized.

Copy link

andreasneuber commented Aug 17, 2019

Thanks! Bookmarked :-)

@wazcov

This comment has been minimized.

Copy link

wazcov commented Nov 28, 2019

which is recommended or best practice?

@alces

This comment has been minimized.

Copy link
Owner Author

alces commented Nov 29, 2019

I don't know anything about official best practices, but by myself most often use the last variant (i.e., playbook header).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.