I'm currently stuck on a bit of an issue trying to pass complex variables 
to a role that I've created, please see this Gist for an example:

https://gist.github.com/Synforge/9665085

I'm currently using Ansible with hash_behaviour merge as I want to manage 
configuration parameters as a hash and then override some of the default 
variables using host_vars and group_vars without having to specify all 
mysql parameters.

In the example above I have a mysql role that has various defaults as a 
hash for the configuration file, the idea is that with merge I can override 
some of these parameters by passing in a complex variable from my host_vars 
folder. I have host_vars set up so that at the moment it only overrides the 
server_id parameter.

The issue that I'm having is that the hashes seem to be being passed in as 
a string to the role (I've tried old style variable and new style variable 
substitution without any luck) so I get this trace when it attempts to 
merge the hashes together:

fatal: [mysql-master-1.example.org] => Traceback (most recent call last):
  File "/home/paul/dev/ansible/lib/ansible/runner/__init__.py", line 527, 
in_executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/home/paul/dev/ansible/lib/ansible/runner/__init__.py", line 562, 
in_executor_internal
    inject = utils.combine_vars(inject, self.module_vars)
  File "/home/paul/dev/ansible/lib/ansible/utils/__init__.py", line 1060, 
incombine_vars
    return merge_hash(a, b)
  File "/home/paul/dev/ansible/lib/ansible/utils/__init__.py", line 545, 
inmerge_hash
    result[k] = merge_hash(a[k], v)
  File "/home/paul/dev/ansible/lib/ansible/utils/__init__.py", line 540, 
inmerge_hash
    for k, v in b.iteritems():
AttributeError: 'str' object has no attribute 'iteritems'

Can anyone confirm whether this is an error with my configuration or a 
known issue?

Many thanks,
Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/88d1ea97-e7ea-468b-a3ea-9c22483a83a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to