# Best practice: Ansible default filename extension for its files

**URL:** <https://forum.ansible.com/t/best-practice-ansible-default-filename-extension-for-its-files/31141>\
**Category:** Ansible Project\
**Created:** [August 27, 2019, 6:17pm UTC](https://forum.ansible.com/t/best-practice-ansible-default-filename-extension-for-its-files/31141 "2019-08-27T18:17:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gilson\_Soares\_GM](https://avatars.discourse-cdn.com/v4/letter/g/e0b2c6/32.png) [@Gilson\_Soares\_GM](https://forum.ansible.com/u/Gilson_Soares_GM)\
**Post date:** [August 27, 2019, 6:17pm UTC](https://forum.ansible.com/t/best-practice-ansible-default-filename-extension-for-its-files/31141/1 "2019-08-27T18:17:55Z")

</div>

I’m new using Ansible but I’d like to start using best practices.

I know that Ansible uses YAML syntax files, not “Ansible format”.

Looking thru the docs, there are several documents using interchangeably YML and YAML.

For example: using ansible\_playbook , **must** include the extension.  
What about some editors which colorizing the syntax.  
Which extension it expects to have to properly identify the file ?

Does anyone have a tip about it ?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 27, 2019, 7:02pm UTC](https://forum.ansible.com/t/best-practice-ansible-default-filename-extension-for-its-files/31141/2 "2019-08-27T19:02:26Z")

</div>

> I'm new using Ansible but I'd like to start using best practices.

IMHO it's no best practice to fit all, it all comes down to what's best for you.

> I know that Ansible uses YAML syntax files, not "Ansible format".

Well, that's not entirely correct, Ansible has two type of syntax YAML and key value.  
Recommendation is to use YAML, but I use them both because key value is faster to write for short debug tasks.

This key value is faster to write  
- debug: var=myvar

than this YAML  
- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;var: myvar

> Looking thru the docs, there are several documents using interchangeably  
> YML and YAML.
> 
> For example: using ansible\_playbook \<file\>, \<file\> \*must\* include the  
> extension.

Most if not all Linux/Unix programs and that includes Ansible don't care about the file extension.  
So you can call them whatever you like, officially I think the YAML people recommend .yaml as the extension.

> What about some editors which colorizing the syntax.  
> Which extension it expects to have to properly identify the file ?

It depends on you editor I guess.

I'm using vim with this plugin[1] and configure it for .yml files that I use for Ansible, and for clean YAML files, aka not Ansible files, get the default vim YAML syntax setting.

[1] [https://github.com/pearofducks/ansible-vim](https://github.com/pearofducks/ansible-vim)

---

<div class="post-metadata">

**Author:** ![Gilson\_Soares\_GM](https://avatars.discourse-cdn.com/v4/letter/g/e0b2c6/32.png) [@Gilson\_Soares\_GM](https://forum.ansible.com/u/Gilson_Soares_GM)\
**Post date:** [August 27, 2019, 8:22pm UTC](https://forum.ansible.com/t/best-practice-ansible-default-filename-extension-for-its-files/31141/3 "2019-08-27T20:22:25Z")

</div>

Thanks Kai for your thoughts.
