Failing on TASK [Read the static blueprint content], variable not accepted
See original GitHub issueHello,
I completed an installation of Hortonworks making small changes to the provided configuration. After the completion i exported the blueprint and tried to install another cluster making use of this blueprint.
I am encountering the following issue:
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: '**zookeeper_log_max_backup_size**' is undefined\n\nThe error appears to have been in 'my-path/ansible-hortonworks/playbooks/set_variables.yml': line 35, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Read the static blueprint content\n ^ here\n"}
The blueprint correctly contains the following:
"zookeeper_log_max_backup_size": "10",
and
log4j.appender.ROLLINGFILE.MaxFileSize={{zookeeper_log_max_backup_size}}MB
If i hard code in the blueprint the value of the variable (10) in all the places where i have the variable the error changes as follow:
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: '**zookeeper_log_number_of_backup_files**' is undefined\n\nThe error appears to have been in 'my-path/ansible-hortonworks/playbooks/set_variables.yml': line 35, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Read the static blueprint content\n ^ here\n"}
For this reason, my understanding is that it is not able to work with variables. Is it expected? Do i need to remove all the variables from the blueprint?
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
Ah, damn, this is Ansible way of defining variables (
{{and}}), interfering with the Ambari way of defining variables in the log4j settings: same ({{and}}).So Ambari thinks it needs the
zookeeper_log_max_backup_sizevariable, but that’s not true, this is for Ambari use only.You should probably surround your blueprint in
{% raw %} ... {% endraw %}statement: https://docs.ansible.com/ansible/devel/user_guide/playbooks_advanced_syntax.html#unsafe-or-raw-stringsAlternatively, you can change
templatewithfilein here: https://github.com/hortonworks/ansible-hortonworks/blob/master/playbooks/roles/ambari-blueprint/tasks/main.yml#L59 if you don’t need to use any Ansible variables in your blueprintI found this (closed) issue when searching for any infos around getting
TypeError: must be string or bufferon the blueprint upload step, exactly as described in this issue:And from Alexandru’s reply:
Note I just reproduced this issue using a recent repo version (https://github.com/hortonworks/ansible-hortonworks/commit/3020c52ae870fb1475e99445e2c6c57bbb014814) that already contains any fixes mentioned in this issue. Finally I found myself a fix, which surprised myself: Simply upgrading to a new enough ansible (v2.6.3), where as a 1.update to v2.5.3 did not fix it ( from the original redhat installed v2.4.2) (ps: If you like I can still create a separate issue, in case other people run into the same issue… )
Details of my TypeError case doing a uri module POST with a dict to_json
My server env (running redhat):
Error msg incl. python stacktrace
Working fix:
Earlier tried fixes not working:
body_format: json, as was proposed in https://github.com/ansible/ansible-modules-core/issues/265