Andrew Berman wrote:
Hello,
I'm new to Ansible and I'm not sure if this is a bug or if I'm doing
something wrong. I currently have a playbook which has vars_prompt and
vars_files in it and no matter what I do, I get a Python error. Here is
the playbook:---
-
hosts: $hostsuser: root
vars_prompt:
-
name: pg_port
prompt: "What port should Postgres run on?"
private: no
default: 5432vars_files:
- vars/postgres.yml
- vars/global_vars.ymlIt works only when I comment out the entire vars_files block. Here is the
Python error:Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 177, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/bin/ansible-playbook", line 148, in main
pb.run()
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py",
line 192, in run
play = Play(self, play_ds, play_basedir)
File "/usr/lib/python2.6/site-packages/ansible/playbook/play.py", line
83, in __init__
self._update_vars_files_for_host(None)
File "/usr/lib/python2.6/site-packages/ansible/playbook/play.py", line
300, in _update_vars_files_for_host
raise errors.AnsibleError("%s must be stored as dictonary/hash: %s" %
filename4)
TypeError: not enough arguments for format stringCan anyone help me?
It looks like your vars_files aren't formatted as dicts. They should look
something like