Hello All,
I am trying to work my way through this playbook, here is what I got so
far, appreciate your input and let me know if this is correct..
Problem now is patches.txt will also be in same in repos as the actual
files, so I am not sure how to provide the path to that file
Appreciate all your inputs here
---
- name: "Download the patches for sage"
hosts: app
vars:
my_dest: /busdata/qwm/mna1/geodev12/folders/GX/PATCH/
my_url: "
https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/
"
tasks:
- get_url:
url: "{{ my_url }}/{{ item }}"
url_username:
url_password:
dest: "{{ my_dest }}/{{ item }}"
register: download
until: download is succeeded
delay: 3
debug:
var: item
with_lines: cat "./path/pateches.txt"
Regards
Amit
On Sat, Jun 10, 2023 at 3:31 PM Amit Kulkarni <[email protected]> wrote:
> .Hello All,
>
> Can someone please help with below.
>
> I need to read the filename from an external file in ansible playbook, if
> someone has done something like this before please let me know.
>
> In the loop there are DAT files which will be changing every time, so I
> need to keep those in an external file and read it in the main playbook.
>
> Appreciate your help.
>
> ---
> - name: "Download the patches for sage"
> hosts: app
> vars:
> my_dest: /busdata/qwm/mna1/geodev12/folders/GX/PATCH/
> my_url: "
> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/
> "
> tasks:
> - get_url:
> url: "{{ my_url }}/{{ item }}"
> dest: "{{ my_dest }}/{{ item }}"
> register: download
> until: download is succeeded
> delay: 3
> my_file: "{{ item }}"
> loop:
> - SRC_WMS_V12_04_0017.dat
> - SRC_WMS_V12_04_0018_txt.dat
> - SRC_WMS_V12_04_0019.dat
> - SRC_WMS_V12_04_0020.dat
>
>
> On Fri, Jun 9, 2023 at 8:22 PM Amit Kulkarni <[email protected]>
> wrote:
>
>> Thanks Abhijeet for your help
>>
>> Is there any way I can move the loop out of the playbook and make it read
>> from the main playbook.
>>
>> These are patch files and will be changing for each patching cycle.
>>
>> Let me know if this is possible.
>>
>> Regards
>> Amit
>>
>>
>>
>>
>>
>> On Fri, Jun 9, 2023 at 6:28 PM Abhijeet Kasurde <[email protected]>
>> wrote:
>>
>>> Little syntax correction -
>>>
>>> ---
>>> - name: "Download the patches for sage"
>>> hosts: app
>>> vars:
>>> my_dest: /busdata/qwm/mna1/geodev12/folders/GX/PATCH/
>>> my_url: "
>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/
>>> "
>>> tasks:
>>> - get_url:
>>> url: "{{ my_url }}/{{ item }}"
>>> dest: "{{ my_dest }}/{{ item }}"
>>> register: download
>>> until: download is succeeded
>>> delay: 3
>>> loop:
>>> - SRC_WMS_V12_04_0017.dat
>>> - SRC_WMS_V12_04_0018_txt.dat
>>> - SRC_WMS_V12_04_0019.dat
>>> - SRC_WMS_V12_04_0020.dat
>>>
>>> On Fri, Jun 9, 2023 at 1:20 PM Amit Kulkarni <[email protected]>
>>> wrote:
>>>
>>>> Hello Abhijit,
>>>>
>>>> Thanks for your help, I came up with another one, if you could provide
>>>> your input that would be great.
>>>> Please let me know is this looking ok, what I am trying to do is t
>>>>
>>>> ---
>>>> - name: "Download the patches for sage"
>>>> hosts: app
>>>> vars:
>>>> my_dest: /busdata/qwm/mna1/geodev12/folders/GX/PATCH/
>>>> my_url: "
>>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/
>>>> "
>>>> tasks:
>>>> - get_url:
>>>> url: "{{ my_url }}/{{ my_file }}"
>>>> dest: "{{ my_dest }}/{{ my_file }}"
>>>> register: download
>>>> until: download is succeeded
>>>> delay: 3
>>>> my_file: "{{ item }}"
>>>> loop:
>>>> - SRC_WMS_V12_04_0017.dat
>>>> - SRC_WMS_V12_04_0018_txt.dat
>>>> - SRC_WMS_V12_04_0019.dat
>>>> - SRC_WMS_V12_04_0020.dat
>>>>
>>>>
>>>>
>>>> On Fri, Jun 9, 2023 at 3:38 PM Abhijeet Kasurde <[email protected]>
>>>> wrote:
>>>>
>>>>> Use
>>>>>
>>>>> dest: "/busdata/qwm/mna1/geodev12/folders/GX/PATCH/{{ item | basename
>>>>> }}"
>>>>>
>>>>> On Fri, Jun 9, 2023 at 12:23 PM Amit Kulkarni <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hello All,
>>>>>>
>>>>>> I have the below playbook, I wanted to download the files from gitlab
>>>>>> on same path with different names. I have below playbook,
>>>>>> As can seen below source path is same but file name is different, I
>>>>>> need to have src path defined and should mention only file names in loop
>>>>>> or
>>>>>> may be i can read these names from different file itself.
>>>>>>
>>>>>> Appreciate any help with this
>>>>>> ---
>>>>>> - name: Download the files from GITLAB for Patching
>>>>>> hosts: app
>>>>>> tasks:
>>>>>> - get_url:
>>>>>> url: "{{ item }}"
>>>>>> dest: /busdata/qwm/mna1/geodev12/folders/GX/PATCH/
>>>>>> url_username:
>>>>>> url_password:
>>>>>> register: download
>>>>>> until: download is succeeded
>>>>>> delay: 3
>>>>>> loop:
>>>>>> -
>>>>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/SRC_WMS_V12_04_0017.dat
>>>>>> -
>>>>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/SRC_WMS_V12_04_0018_txt.dat
>>>>>> -
>>>>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/SRC_WMS_V12_04_0019.dat
>>>>>> -
>>>>>> https://raw.gitlabusercontent.michelin.com/na-sc/na-log/wms_nca/wms_na_patch/sagepatch/SRC_WMS_V12_04_0020.dat
>>>>>>
>>>>>> --
>>>>>> 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/CAON3ZR2d9hJ7PHdRW1ToRHQhXL9gm-Qa08aw0jb11vj2vWQH2A%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/ansible-project/CAON3ZR2d9hJ7PHdRW1ToRHQhXL9gm-Qa08aw0jb11vj2vWQH2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thanks,
>>>>> Abhijeet Kasurde
>>>>>
>>>>> --
>>>>> 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/CAFwWkHoj%3DVvJgTNzMkZaObw3GuZku1kdGEs-s2Lsi3aR3hauwg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHoj%3DVvJgTNzMkZaObw3GuZku1kdGEs-s2Lsi3aR3hauwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>
>>> --
>>> Thanks,
>>> Abhijeet Kasurde
>>>
>>
--
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/CAON3ZR3zT6XQJcxTNYzh16g6cBCcJv6Bn_iNK6pnFn-_LwEcSg%40mail.gmail.com.