Welcome, Guest! Registration

loc2log

Sunday, 2024-12-22
Main » 2024 » March » 25 » Execute Ansible for Local Tasks
11:10 PM
Execute Ansible for Local Tasks
To make Ansible execute a local task, just add corresponding value to hosts directive:
- name: Local task
  hosts: localhost
  ...
Then, playbook can be executed simply by calling
ansible-playbook playbook.yml
More flexible approach is
- name: Do anywhere task   hosts: all   ...
And execute with
ansible-playbook playbook.yml --connection=local -i localhost,
Views: 362 | Added by: ep | Tags: ansible, Linux, Best Practice, scripting, Admin | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]