Skip to content

Instantly share code, notes, and snippets.

@gh640
Created June 16, 2021 08:16
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 gh640/2a347dd978c114da216e8727c3e51d5d to your computer and use it in GitHub Desktop.
Save gh640/2a347dd978c114da216e8727c3e51d5d to your computer and use it in GitHub Desktop.
Sample: Ansible inventory for localhost
---
all:
hosts:
localhost:
ansible_host: localhost
ansible_connection: local
ansible_python_interpreter: '{{ ansible_playbook_python }}'
@gh640
Copy link
Author

gh640 commented Jun 16, 2021

Or, playbooks can be run on localhost without any inventory.

---
- hosts: localhost
  gather_facts: no
  tasks:
    - ansible.builtin.command:
        cmd: [commands]

Warning message displayed when I ran this playbook without any inventory:

[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the
implicit localhost does not match 'all'

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