ansibledeb

Installing the deb package via ansible


I am trying to install a deb package on a remote server using ansible, using the following construction

- name: Install deb
  delegate_to: app1
  apt:
    deb: https://example.com/deb/package.deb

or

- name: Install deb
  delegate_to: app1
  apt:
    deb: /path/to/deb

playbook works, says that everything is ok, but in fact the package is not installed, if you connect to a remote server and manually run apt install /path/to/deb, then the package is installed. I tried to copy deb to the server using ansible and install it by downloading the package from an Internet resource, the result is always the same


Solution

  • The following modification of the task helped

    - name: Install deb
      command: apt install /path/to/package.deb -y --allow-downgrades
    

    The allow_downgrade directive for the apt module appeared, starting with the ansible 2.12 version in my 2.9 it did not work, as the force directive did not work, I had to implement the task using a not very nice method.