I believe your approach to be the most robust and standard within the
community.

There is this concept of DRY that I feel too many people get captured in.
In general I would say that much of The Zen of Python applies to
overthinking playbooks too.

One thing that you need to take into account is that package names are also
often different between OSes, there are ways to get around it, but I think
I would consider them a bit too clever and would potentially create
confusion with maintaining the plays down the road.

On Sunday, November 2, 2014, Andrew Rothstein <andrew.rothst...@gmail.com>
wrote:

> I like Ubuntu but I want to switch to Fedora. I'm trying to port my
> playbooks that I wrote to work on Ubuntu and port them to Fedora. Here is
> the most I've been able to factor my roles down to:
>
> ---
> - name: file system related packages (Ubuntu)...
>   apt: name={{item}}
>   when: ansible_distribution == "Ubuntu"
>   with_items:
>     - sshfs
>     - cifs-utils
>     - samba
>     - samba-common
>
> - name: file system related packaged (Fedora)...
>   yum: name={{item}}
>   when: ansible_distribution == "Fedora"
>   with_items:
>     - sshfs
>     - cifs-utils
>     - samba
>     - samba-common
>
> I'm rolling my eyes at the amount of boilerplate copy and paste in here.
> Is there a better recommended practice or trick that you recommend? Should
> I be creating separate roles and knitting the roles together in different
> playbooks by platform?
>
> regards, Andrew
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','ansible-project%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to ansible-project@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','ansible-project@googlegroups.com');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/505242f0-aadb-432f-862e-3867881bc3c7%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/505242f0-aadb-432f-862e-3867881bc3c7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v-KaQaspg2vjgr%2BtO%3DMvRByr5WvfzBqinXuPr6Exqo3pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to