Skip to content

Instantly share code, notes, and snippets.

@bneutra
Last active February 25, 2021 16:21
Show Gist options
  • Save bneutra/39b8d7036a5f8c593c1d9ef616978429 to your computer and use it in GitHub Desktop.
Save bneutra/39b8d7036a5f8c593c1d9ef616978429 to your computer and use it in GitHub Desktop.
testing ansible commands with a simple local playbook
---
# Here's a basic example if you want to just test out ansible commands on
# your localhost (without the complexity of ssh). Note: this assumes you
# have a properly installed ansible.
# e.g. install py 3.6.4. with pyenv and pip install ansible
# To run these tasks (you may need to run as sudo):
# ansible-playbook [this_file.yml]
- name: run the playbook tasks on the localhost
hosts: 127.0.0.1
connection: local
become: yes
tasks:
- name: touch a file
file:
state: touch
path: "/tmp/testfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment