Hi friends,

I want to use ansible to merge below 2 dictionary to become 1.
I have been stucking for few days already. Headache.

I have 2 variables now.

*1. variable "my_directories":*

{
    "directoryA": [
        "/bar/foo/file1.txt",
        "/bar/foo/file2.txt"
    ],
    "directoryB": [
        "/bar/baz/file3.txt",
        "/bar/baz/file4.txt",
        "/bar/baz/file5.txt"
    ]
}


*2. variable "my_filecontents":*

{
    "/bar/foo/file1.txt": "file1Content",
    "/bar/foo/file2.txt": "file2Content",
    "/bar/baz/file3.txt": "file3Content",
    "/bar/baz/file4.txt": "file4Content",
    "/bar/baz/file5.txt": "file5Content"
}


i want to merge it to become:

*Result variable: "my_result"*

{
    "directoryA": {
        "/bar/foo/file1.txt": "file1Content",
        "/bar/foo/file2.txt": "file2Content"
    },
    "directoryB": {
        "/bar/baz/file3.txt": "file3Content",
        "/bar/baz/file4.txt": "file4Content",
        "/bar/baz/file5.txt": "file5Content"
    }
}




The directories and files could be dynamic.
I tried so many codes but still did not work.

Thank you!

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/08952920-f57a-4b18-a979-b8d0eae84e12%40googlegroups.com.

Reply via email to