S
S
Sergei Sakharov2021-10-01 11:40:24
OpenBSD
Sergei Sakharov, 2021-10-01 11:40:24

Ansible - how to check if the software is installed before installation?

I study ansible - there is a server and four patients. I want to select two patients as web servers and install php-fpm, nginx and mariadb-server on them. With the selection of a group and the installation of software, no problems are foreseen, but I want to check before installing whether this software is already installed. How to write a playbook?
So far, of all the examples, only Linux, mostly Debian, and something is not found with pkg_add and pkg_info examples.
Yes, on OpenBSD-6.8 server and patients

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2021-10-01
@karabanov

No need to check. Ansible is idempotent and brings the server configuration to the one described in the playbook.
If the playbook describes the installation of software, and it is already on the server, then Ansible will do nothing, a green message will be displayed in the log stating that there are no changes.
Manage packages on OpenBSD
PS
The main thing is not to use latest, as the update to the current version will be performed, which, in general, does not contradict the above.

P
Puma Thailand, 2021-10-01
@opium

No, the installation recipes for software in ansible are idempotent, if the software is already installed, it will not be installed again

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question