I have a tasks file with a TASK like this
- set_fact:
new_pgport: "{{ databaseport|default(next_port) }}"
new_pginstance: "{{ instanzname }}"
new_pgdata: "{{ postgres_data_root }}/{{ new_pginstance }}"
...
a playbook executes this further down inside a role and is called with
ansible-playbook pg_instance_add.yml -e '{"databaseport":"5448" , "instanzname":"bitbucketp"}'
and fails complaining that new_pginstance
wouldn’t have a value assigned to it.
for troubleshooting I add a debug right before that set_fact
- debug:
msg: "instanzname = {{ instanzname }}, port = {{ databaseport }}"
… witch displays both (instanzname
& databaseport
) values correctly.
I can work around this by adding -e '{"new_pginstance":"bitbucketp"}'
to the execution command (so I have this twice in the call, which seems not as it should be
I would rather understand why the assining of the value for instanzname
into new_pg_instance
obviousely does not work as expected.
Any hints what I am doing wrong?
a little more detail on the error message:
"An unhandled exception occurred while templating '{{ instanzname }}'. Error was a <class 'ansible.errors.AnsibleError'>"