Ansible only exists because of an influx of people who don't know how to do this.
Bash can be idempotent but isn’t by default, so you either spend time making and idempotent bash script or you spend time learning Ansible to accomplish the same thing in a reusable way