I tried a simple install/uninstall ansible playbook with dropbear but not able to remove the module by setting apt state to absent.
---
# filename: install.yaml
- hosts: all
become: yes
tasks:
- name: install dropbear
tags: dropbear
apt:
name: dropbear
---
# filename: uninstall.yaml
- hosts: all
become: yes
tasks:
- name: uninstall dropbear
tags: dropbear
apt:
name: dropbear
state: absent
When running the uninstall.yaml ansible playbook, it prints out that the task is OK and state has been changed. I ssh into the target server but the dropbear command still exist.