Use state: present for the Ansible apt module
Best to split "installing a package" (state: present) from "upgrading a package" (state: latest) - the latter makes apt do a lot of work, and it's simpler to have a single separate task that just does "apt upgrade" system-wide. The state: present clause only does work on the first installation.