How to handle package manager depending installations?

21 views
Skip to first unread message

thomas....@teamaol.com

unread,
Oct 15, 2014, 3:44:31 AM10/15/14
to ansible...@googlegroups.com
Hi,

I would like to know how to organize one task that I can install packages depending on the ansible_pkg_mgr variable?
Could you please provide an example, if possible?

Please note: I know ... I can create two tasks with a "when" clause. I have that in place.

Kind regards,
Thomas

Example Dictionary in vars/main.yml:

packages:
    apt:
        - exuberant-ctags
        - cgdb
        - figlet
        - scite
        - graphviz

    yum:
        - ctags
        - cgdb
        - figlet
        - graphviz

Seth Edwards

unread,
Oct 15, 2014, 10:52:00 PM10/15/14
to ansible...@googlegroups.com

I think if you separated it this way, it might get rid of the need to define these in vars

Igor Homyakov

unread,
Oct 16, 2014, 1:31:46 AM10/16/14
to ansible...@googlegroups.com
Hi,

Please have a look at https://gist.github.com/hostmaster/db37c8e6c2a43997a224

It is not probably what you are looking for exactly, however it is
very close and it works.
And I hope the idea is clear.

-- Best, Igor
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/36cbd28b-6849-4fb5-badb-e7136c6bfdcb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages