Refactoring and enhancing Ansible scripts