Reputation: 75
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
Upvotes: 5
Views: 22888
Reputation: 420
You have to use the privilege escalation methods become
and become_method: sudo
for Ansible. Installing a package need sudo
privilege.
- name: Install deb
delegate_to: app1
apt:
deb: /path/to/deb
become: true
Upvotes: 10
Reputation: 75
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.
Upvotes: -2