tell me the difference between running the command ansible and the playbook ansible?

Ansible scripts are called playbooks.

By definition

A playbook is a list of plays. A play is minimally a mapping between a set of hosts selected by a host specifier (usually chosen by groups but sometimes by hostname globs) and the tasks which run on those hosts to define the role that those systems will perform. There can be one or many plays in a playbook.

https://docs.ansible.com/ansible/latest/reference_appendices/glossary.html#term-plays

Then, you execute your playbooks with the command ansible-playbook, for example this command execute the playbook test.yml on all servers in your inventory file:

ansible-playbook test.yml -i inventory all

with ansible command you can execute just a tasks against your servers, for example this command execute a task with the module ping on all servers in your inventory file:

ansible -m ping -i inventory all

Then the difference is with ansible-playbook you can execute a playbook with a lot of tasks and with ansible you just can execute a task.

Welcome to ansible world. Red Hat offers an introductory course of ansible you can take it, It’ll help you a lot.

https://www.redhat.com/en/services/training/do007-ansible-essentials-simplicity-automation-technical-overview

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top