For the complete documentation index, see llms.txt. This page is also available as Markdown.

Run Ansible Playbook Locally

At times, we require an Ansible Playbook to run locally on the host server. Few examples are given below -

1. Using Ansible Commandline

ansible-playbook --connection=local --inventory 127.0.0.1, playbook_name.yml

2. Using Ansible Inventory File

We can also, add the host in an inventory file such as -

127.0.0.1 ansible_connection=local

3. Using Ansible Configuration File

[defaults]
transport = local

4. Using Playbook Header

- hosts: 127.0.0.1
    connection: local

Source: GitHub Gist - Ansible playbook Locally

Reference(s):

Last updated