Não consigo reproduzir seu erro com este manual:
- hosts: 10.0.0.2
sudo: yes
tasks:
- name: Install via apt
action: apt pkg=$item
with_items:
- build-essential
- python-dev
- python-software-properties
Como esperado, as execuções consecutivas do manual são idempotente :
$ ansible-playbook pkg.playbook -K
sudo password:
PLAY [10.0.0.2] *********************
GATHERING FACTS *********************
ok: [10.0.0.2]
TASK: [Install via apt] *********************
ok: [10.0.0.2] => (item=build-essential,python-dev,python-software-properties)
PLAY RECAP *********************
10.0.0.2 : ok=2 changed=0 unreachable=0 failed=0