So Ansible provides a feature called vault password file. It's a file that contains passwords needed to encrypt the files. You can reference this file while executing the playbook and now that's called automation. You can reference the password file in the following manner:
ansible-playbook site.yaml --vault-password-file ~/ .vault_pass.txt