Hi All ,I have some doubts on ansible topic

Hi All,I am learning ansible beginners course.

Here is my some of my doubts

1.why we are using “—” in scripting at first line
2.why we are using become: true in scripting and when is required exactly ? and some times we are using become: yes , what is the difference on both

3.what is gather_facts: no

  1. what is connection: local a

Hi @grandhivenkatesh20 ,

I’ll respond online :

The - - - is use on yaml file for mainly two reason :

  • Define the beginner of the file
  • Separate multiple yaml if we have multiple yaml block on the same file

Both are the same you can use yes or true indifferently. become is used mainly when we need privilege escalation, for example when we need to install a package or do a task needs some privilege on the system :

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html

gather fact is a module loading by default by Ansible, he charges some environment we can use after on the Playbook yaml file, but usually, we disable it for performance is this is why you see gather_facts: no on some playbooks

It is to execute the tasks locally on the same host (i.e., the controller) where the playbook is run.

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html#local-playbooks

Regard

Thank you so much for your replies.