I am trying to install a .deb file. Currently, I am just trying it out before actually deploying it but the copying keeps failing.
Here's my ansible-deb-installation.yaml:
- name: Install .deb packages
hosts: hosts
become: true
tasks:
- name: Copy .deb files to the remote host
copy:
src: /home/$USER/my-deb.deb
dest: /home/ansible/
- name: Install .deb packages
apt:
deb: /home/ansible/my-deb.deb
update_cache: yes
register: apt_install_result
- name: Display installed packages
debug:
var: apt_install_result
I am getting this error:
TASK [Copy .deb files to the remote host] ************************************************************************************************************
fatal: [192.168.1.12]: FAILED! => {"changed": false, "checksum": "24666b3d4b2ebb70463c05e3bab49a21b183c30a", "msg": "Source /home/ansible/.ansible/tmp/ansible-tmp-1691040448.7838528-56121-85302757455574/source not found"}
I have cross checked and verified the path to the .deb file but I still keep getting this error. I am not sure what else I am doing wrong here.
Check on the Ansible controller what the complete path is of the .deb file.
The
srcyou provided here is incorrect. A playbook written in .yml does not handle bash expansion.Change that path to the full path, or use a variable, e.g.
The remaining part of your playbook looks fine.