You can use the ansible module called profile_liberty for this:
- name: Create
profile_liberty:
state: present
libertydir: /usr/local/WebSphere/Liberty/
name: server01
- name: Remove
profile_liberty:
state: absent
libertydir: /usr/local/WebSphere/Liberty/
name: server01