down votefavorite <https://serverfault.com/questions/868770/ansible-pass-dictionary-from-python-script#>
I am running a Ansible script that calls a python script, which manipulates some data and turns it into a dictionary. I want to redirect the python dictionary to a register and then use it replace sections of a json file. My script runs without any messages. I can run the python script by itself and it prints out the dictionary. What am I doing wrong? Is this the best way to do this? Is it better to use shell, command or script to call python scripts? pyscript.py pydict[pykey] = pyvalue print (pydict) ansiblescript.yml --- - hosts: 10.215.237.238 tasks: - name : Gather info shell: '/usr/bin/python /home/devoper/scripts/pyscript.py' register: pydict - name: Insert Info replace: destfile: /home/devoper/scripts/template.json regexp: "KEY1" replace: "{{ pydict.pykey }}" backup: yes Thank you for your time. -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d6b7f1a2-8ddc-4c58-9cb6-2928da6f7017%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.