Skip to content

Instantly share code, notes, and snippets.

@jiahut
Forked from alces/ansible_local_playbooks.md
Last active June 6, 2019 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiahut/a7c3c344f5bfc577f2f79e69c82f9e9a to your computer and use it in GitHub Desktop.
Save jiahut/a7c3c344f5bfc577f2f79e69c82f9e9a 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 with sudo privileges

ansible-playbook -i localhost, install-docker-ce-centos.yaml  -K
# or
sudo ansible-playbook -i localhost, install-docker-ce-centos.yaml

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

reference

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