I need to create an ansible-vault file to store credentials in a task in a playbook. This file would be used by another playbook. Is there an internal ansible method/module to accomplish this? I would prefer not to do it invoking shell/command. Any help would be highly appreciated.
No, there is no ansible-vault module, ansible-vault is a command line program.
Generic command, script, or shell tasks could work, if a specialized module is not available.
ansible-vault encrypt
in this case.