copy j2 file to Json on windows server

Hi,

Im trying to create a json file using jinja2 template using the following play. The file is not creating and not giving any error. can any one help.

- name: creating a config file
win_copy:
content: “{{ lookup(‘template’,‘config.j2’) | to_nice_json }}”
dest: “D:\config1.json”
remote_src: true

Thank you,
Shyam

Remove remote_src: true as it’s expecting you to supply src for the copy. Better yet use win_template instead like

`

  • win_template:
    src: config.j2
    dest: D:\config1.json

`

Hi Jordan,

I have tried the suggested code but still have the same issue and it is not creating the file or updating the file content.

  • win_template:
    src: config.j2
    dest: D:\config1.json

Thanks and Regards,
Shyam

Please post a full debug log using -vvv

Hi,

Im using Ansible tower and j2 file and playbook are in GitHub, can you please check the attached log,

Thank you,
shyam

(attachments)

I see a photograph of a screen that displays a non verbose playbook run without any useful information.

Please contact Redhat for support with Tower.

Hi,

Im using Ansible tower and j2 file and playbook are in GitHub, can you please check the attached log,

Thank you,
shyam

Ansible tower is not a subject of this list, only Ansible itself.
Please contact RedHat support.

Regards
        Racke

The output shows a change occured and the file was templated. If the contents weren’t what you were expecting then you need to fix the template or make sure you are checking the right server.

Hi,

Thanks it’s working fine now.

Thank you,
Shyam