I am trying to run a playbook with a file that has been encrypted using ansible-vault. However, I get the following error:
ERROR! Syntax Error while loading YAML.
could not find expected ':'
The error appears to have been in 'inventories/group_vars/main_server': line 41, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
Content of vault file:
me@server:ansible$ cat inventories/group_vars/main_server
$ANSIBLE_VAULT;1.1;AES256
...
Command I'm running:
ansible-playbook -i inventories/group_vars/main_server --extra-vars "target=my_target" playbook.yml --ask-become-pass --ask-pass --vault-password-file vault_pwd.txt
vault_pwd.txt
is populated with the required password. I have been encrypting/decrypting as I develop my playbook. For instance, the shell script with the encrypting command:
ansible-vault encrypt inventories/group_vars/main_server --vault-password-file vault_pwd.txt
Edit #1
Version of Ansible:
me@server:ansible$ ansible --version
ansible 2.7.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/me/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]