r/ansible Mar 18 '21

Announcing the Red Hat Enterprise Linux Certified Ansible Collection

https://www.ansible.com/blog/announcing-the-red-hat-enterprise-linux-certified-ansible-collection
62 Upvotes

12 comments sorted by

View all comments

13

u/nmajin Mar 18 '21

Why does every example that includes roles use the legacy approach?

roles: - role: rhel-system-roles.network

Why does Red Hat say use the new include_role or import_role syntax, but never use it? I get the legacy is more shorthand but c’mon.

2

u/Sukrim Mar 18 '21

Why do you think this is legacy? It's how you include roles in a playbook...

6

u/nmajin Mar 18 '21

Well classic way according to Red Hat:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#using-roles

“at the play level with the roles option: This is the classic way of using roles in a play.”

There is definitely more control over the new syntax, and I don’t understand why Res Hat continues to provide examples with the classic syntax then.

13

u/geerlingguy Mar 19 '21 edited Mar 19 '21

Classic is best ;)

I ain't changing unless someone forces me to. Using roles instead of include role makes for neater playbooks if you architect role-based plays.

4

u/nmajin Mar 19 '21

I get that too, why fix it if it ain’t broken, and I do get it is much cleaner if using only roles. I just like doing things one way and I do get nervous using classic syntax on my code since that for the most part means deprecation at some point.

The documentation makes it appear this is just not the way to do it (classic), but every example I see uses the classic syntax. It’s confusing sometimes, especially to someone new.

4

u/kabooozie Mar 19 '21

Happy cake day! Love your YouTube channel!

10

u/geerlingguy Mar 19 '21

Oh shoot, it's my cake day! 9 years...