I can show a dummy thing:
So i am using blockinfile module.
blockinfile:
path: /tmp/item.ci_name/vars
block: |2
{{ ansible_loop.index}}:
artifact_name: {{ item.1.artifact_id}}
artifact_version: {{ item.1.artifact_version}}
insertafter: "artifact:"
with_subelements:
- "{{ custom.results}}"
- json.result.artifacts
Regards,
Soumya
On Thu, Aug 20, 2020, 7:00 PM Dick Visser <[email protected]> wrote:
> Can you show us your actual code
>
> On Thu, 20 Aug 2020 at 15:25, soumya dutta <[email protected]>
> wrote:
>
>> Hi,
>>
>> I have a situation where I have few servers and there are different
>> artifacts or rpms are installed. I am getting all data for all servers in a
>> clubbed list and based on that I am creating files for each server and the
>> respective rpms data are posted to that file.
>>
>> So suppose server 1 has 5 rpms and server 2 has 2 rpms and file I will
>> create it should look like this.
>> File1:
>> artifact:
>> 1:
>> artifact_name:
>> artifact_version:
>> 2:
>> artifact_name:
>> artifact_version:
>> Similarly till 5 and similarly on the other file there will be two
>> entries under artifact as 1 & 2.
>>
>> But on using loop index for file1 i get 5 numbers but for file 2 instead
>> of starting the number with 1 it starts with 6.
>>
>> Help on this is really appreciated.
>>
>> Regards,
>> Soumya
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> 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/CAH6PPPtxWF%3DzcEp8p-%3Dyd8TOMkw7YZbm3rj1moHp8GEoVoQMHg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAH6PPPtxWF%3DzcEp8p-%3Dyd8TOMkw7YZbm3rj1moHp8GEoVoQMHg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwMqkRGBxH7W3zf66P72ymsoisjuu2ccu08kuRZ3hjobTA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwMqkRGBxH7W3zf66P72ymsoisjuu2ccu08kuRZ3hjobTA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CAH6PPPvar7tePbNYTZBgFqpracvuH7em1Nidk-pHv6KNb%2B-d8Q%40mail.gmail.com.