Write all you licenses in a licenses.txt file. One per line
Play this ansible playbook on it, you may include the code in my ansible datacenter creation sample
This code do not remove license because of the static line : state: present