Hi ,
Can any one plese help me to know , How multiple json files and j2 files
pass to template module to generate different config files .
- name: read the json file variables
include_vars:
file: "{{ item }}"
with_items: '{{ get_filepattern }}'
- name: Ensure files are populated from templates
template:
src: '{{ item.src }}'
dest: '{{ templates_destination }}/{{ item.path }}.config'
with_filetree: '{{ templates_source }}'
when: item.state == 'file'
here src: taking j2 files
It taking one josn file from include_vars and executed against every .j2
files and generate different configfiles as per number of .j2 files
But not able to take 2nd json file and the same in next itteration .
Please help on it
On Wednesday, February 19, 2020 at 7:42:56 PM UTC+5:30, Janmejaya Swain
wrote:
>
> Hi ,
>
> Can any one please help on this, which is very appreciable. .
>
> ---
> - hosts: all
> remote_user: root
> vars_files:
> - json/UAT.json
>
> tasks:
> - name: Generate configGen files
> template:
> src: /template/test.j2
> dest: /properties/test.properties
> remote_src: yes
> template_host: < host ip >
>
>
> Error:
>
> ERROR! vars file /template/test.j2 was not found
>
> 15
>
> Could not find file on the Ansible Controller.
>
> 16
>
> If you are using a module and expect the file to exist on the remote, see
> the remote_src option
>
>
> In same way it showing it showing json/UAT.json was not found.
>
>
> NOTE: Can you please help on it and we are using ansible 2.9.
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c880147a-0171-4a69-9988-0b8d18d4e4eb%40googlegroups.com.