Ansible: Could not find aptitude. Please ensure it is installed Error and Solution

Posted on in Categories , , , last updated June 13, 2017

I am running the ‘ansible-playbook -i hostnames upgrade.yml‘ command but getting an error that read as follows

fatal: [db1]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Could not find aptitude. Please ensure it is installed.“}

My yml file includes the following line:

- apt: update_cache=yes upgrade=yes

How do I fix this error on a Debian or Ubuntu Linux server?