How to do best organization of install and delete in the same ansible playbook?

Hello,
I try to figure how I must to construct an ansible playbooks with install/delete commands where it’s variable changes.
For example apt_repository,apt,yum… where state=present → installed and state=absent → deleted

If I create two ansible playbooks: delete.yml and install.yml. There are may be problem’s like:
I added to installation someting, but don’t change deletion

Example:

install.yml: