[talk] New Ideas Ansible Unify or Not: was Re: classifying BSD init

Patrik Lundin patrik at sigterm.se
Sun Sep 6 06:40:40 EDT 2015

On Sun, Sep 06, 2015 at 03:46:30PM +0530, Sujit K M wrote:
> On Sun, Sep 6, 2015 at 3:08 PM, Patrik Lundin <patrik at sigterm.se> wrote:
> > On Sun, Sep 06, 2015 at 07:44:32AM +0530, Sujit K M wrote:
> >> On Sat, Sep 5, 2015 at 6:47 PM, Patrik Lundin <patrik at sigterm.se> wrote:
> >>
> >> These are just documentation of the yum/apt or openbsd modules. Below
> >> what I mean.
> >>
> >> https://raymii.org/s/tutorials/Ansible_-_Only_if_on_specific_distribution_or_distribution_version.html
> >>
> >
> > What I am aiming for is writing playbooks where ansible already takes
> > care of the "when: ansible_distribution ==" magic (which it does, and
> > populates the "ansible_pkg_mgr" fact for you).
> So why do you want to do this?

It is less to type, and less logic to keep track of yourself.

> Say are writing a playbook for apache HTTPD, which I hope is free from any Linux
> distributions, this should work cleanly right now. Could you be please
> be more clearer.

It can be done currently by calling $ansible_pkg_mgr for installing the package,
and the "service" module directly for starting it.

Being able to document that you should use $ansible_service_mgr instead
makes the playbook layout more uniform in my view (and leads the way for
how other modules performing another task using different backend tools
should be written).

I feel that this discussion should be continued in the context of PRs
against the ansible code base. Hope you are OK with that.

Patrik Lundin

More information about the talk mailing list