I think what you want to do to use cli is specify the path as your var name just like your example, and then in your code when you invoke the variable, use the file lookup:
I’m not clear if you will need to do something beyond that for it to naturally interpret the yaml object though there’s a chance you’ll still end up with a string.
Hm okay I'm not sure that would work, but gojng back to your original example, have you tried passing the yaml file like this when you run the playbook?
"--extra-vars=@your_yaml_file.yml"
Reading I think that should work the same as running it "with_vars"
I tried your previous suggestion , ansible-playbook ansible_dictionary.yml -e INV_FILE=dictionaryFile.yamlBut unable to print key values in dictonary format , For example - Each key is product. Parse the each key and extract the “product_name”, “release_candidate” and “version“
The above issues (Recent as of Dec 2018) point out that YAML was never accepted as CLI args, though at one point the documentation erroneously claimed it was.