Use the packaging modules. For example:
# Install the package "foo"
- apt: pkg=foo state=present
As to "if its already installed", all ansible packages are idempotent and (whenever possible) do not re-do work that is already done.
Question
i am just leaning ansible
and so far i was able to ping the servers.
My main aim now is to install following modules like apache , git
and if its already installed then should should not do anything.
I am not able to find how can i start with that
Solution
Use the packaging modules. For example:
# Install the package "foo"
- apt: pkg=foo state=present
As to "if its already installed", all ansible packages are idempotent and (whenever possible) do not re-do work that is already done.