How to store/retrieve multiple ansible-vault passwords within/from a single file Update: As @yaobin pointed out. It appears they removed the part about the multiple passwords being in a single file. It was here as can be seen from web archive:
https://web.archive.org/web/20201202040251/https://docs.ansible.com/ansible/latest/user_guide/vault.html
But now it is gone:
https://web.archive.org/web/20210128225633/https://docs.ansible.com/ansible/latest/user_guide/vault.html
So I am not sure if this problem can be solved anymore the way that was described in the manual at the time. It was apparently a manual bug :(

The manual says at storing passwords in files section:

To store a vault password in a file, enter the password as a string on
a single line in the file. Make sure the permissions on the file are
appropriate. Do not add password files to source control. If you have
multiple passwords, you can store them all in a single file, as long
as they all have vault IDs. For each password, create a separate line
and enter the vault ID, a space, then the password as a string. For
example:

and there is an example:
dev my_dev_pass
test my_test_pass
prod my_prod_pass

However there is no usage exampes for this file. I tried many different ways. If I use --vault-password-file the ansible-vault sees only default entry independent of the number of entries in file. With --encrypt-vault-id=test I get:
ERROR! Did not find a match for --encrypt-vault-id=test in the known vault-ids ['default']

If I use --vault-id abc@file_path with --encrypt-vault-id=test then I get error
ERROR! Did not find a match for --encrypt-vault-id=test in the known vault-ids ['abc']

What is the purpose of the password file described in the Ansible manual and how does one use it?
Thanks!
I totally misunderstood you. Here is a new attempt to actually answer your question. :)

Create a passwords file:

root@2ca77340d571:/# cat .passvaults
dev my_dev_pass
test my_test_pass
prod my_prod_pas


Create a file to encrypt:

root@2ca77340d571:/# cat extravaulty.yml
chocolate:banana


Encrypt the file:

root@2ca77340d571:/# ansible-vault encrypt --vault-id=dev@.passvaults extravaulty.yml
Encryption successful


View the raw file:

root@2ca77340d571:/# cat extravaulty.yml
$ANSIBLE_VAULT;1.2;AES256;dev
33336336336238326137393764316333623231336238323931306166626434653164326330656566
3561356333343435663538623661363661373461356461300a663361666331323031623530343930
62633230636566643339663637386438336539383162346634393031633165333033396238363163
6134383233346538330a326266626261346638303738313862656337396237343231326231656139
34376334663664343164303462356431306539316232323761386164643735376330

and the decrypted file:
root@2ca77340d571:/# ansible-vault view --vault-id=dev@.passvaults extravaulty.yml
chocolate:banana

As I understand it, when you use --vault-id=dev@.passvaults you are telling it to use dev as a hint (not the vault password) and .passvaults as the file where the encrypt/decrypt password is.
This means that you can also do this:
root@2ca77340d571:/# ansible-vault view --vault-id=prod@.passvaults extravaulty.yml
chocolate:banana

Or this
root@2ca77340d571:/# ansible-vault view --vault-id=.passvaults extravaulty.yml
chocolate:banana

Which is not intuitive to me.
Does this help?