Hey guys,

so we have a complex variable which we would like ansible to merge. It does 
not seem to be doing this and i am trying to figure out why this is 
happening (hash_behaviour=merge is configured).

here is the information:

   - Ansible version 1.9.1
   - The files in question are inventory variables. 
   - First file is global setting (not specific environment) and is found 
   on: /ansible_code/group_vars/dbonline.yml
   - Second file is specific environment and is found on: 
   /ansible_code/environments/[ENV_NAME]/group_vars/dbonline.yml

here is the playbook i am running:
---
- hosts: dbonline[0]
  gather_facts: false
  tasks:
    - name: configuration enforcement
      action: ConfigDataEnforcer
              besURL={{env_all_bes_url}}
              configData='{{env_dbonline_configdata | to_json}}'



here is an example of the global file:
---
  env_dbonline_configdata: {
    "10000000-0000-0000-0000-000000000001":
      [
        {
          "configname":"A",
          "configvalue":"a"
        },
        {
          "configname":"B",
          "configvalue":"b"
        },
      ],
}


here is an example of the specific environment file:
---
  env_dbonline_configdata: {
    "10000000-0000-0000-0000-000000000001":
      [
        {
          "configname":"A",
          "configvalue":"aaa"
        },
        {
          "configname":"C",
          "configvalue":"c"
        },
      ],
    "20000000-0000-0000-0000-000000000002":
      [
        {
          "configname":"X",
          "configvalue":"x"
        },
        {
          "configname":"Y",
          "configvalue":"y"
        },
      ],
}


My expected merge result would be:
---
  env_dbonline_configdata: {
    "10000000-0000-0000-0000-000000000001":
      [
        {
          "configname":"A",
          "configvalue":"aaa"
        },
        {
          "configname":"B",
          "configvalue":"b"
        },
        {
          "configname":"C",
          "configvalue":"c"
        },
      ],
    "20000000-0000-0000-0000-000000000002":
      [
        {
          "configname":"X",
          "configvalue":"x"
        },
        {
          "configname":"Y",
          "configvalue":"y"
        },
      ],
}

what actually happens is i receive the merge result of the just the global:
---
  env_dbonline_configdata: {
    "10000000-0000-0000-0000-000000000001":
      [
        {
          "configname":"A",
          "configvalue":"a"
        },
        {
          "configname":"B",
          "configvalue":"b"
        },
      ],
}

 I am not sure what can i do to receive my wanted result as the merge in 
question is quite complex (nested values, addition of new values per each 
level and update of values within internal level)

Can anyone assist?

Thanks,

-- 
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/af7bdfc4-00fc-43f4-9493-5251411a6e01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to