Hey @Jolly,
You can use the --vault-password-file option for ansible-vault non-interactive vault file creation. The file passed in can be a text file containing the vault password, or it can be an executable script that retrieves and outputs the vault password.
You can call it like this:
ansible-vault --vault-password-file=vaultpass.txt encrypt sensitive_data.txt