Hi 
Can anybody suggest

My playbook:
---
- hosts: localhost
  vars:
   input_file: rel.yml
   var: "{{ lookup('file', '{{ input_file }}') }}"
  tasks:
     - name: Parse and extract the input yaml
       debug:
         msg: "{{ var | ('^{0}'.format(file_name)) }}"

 Actual o/p:
TASK [Parse and extract the input yaml] 
********************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "template error while templating 
string: expected token 'name', got '('. String: {{ var | 
('^{0}'.format(file_name)) }}"}

expected o/p:
 file_name: some.tar
file_name: some1.tar
file_name: some2.gz

On Thursday, July 11, 2019 at 7:35:45 PM UTC+5:30, Dick Visser wrote:
>
> On Thu, 11 Jul 2019 at 15:53, Rakesh Parida <[email protected] 
> <javascript:>> wrote: 
> > 
> > Hi, 
> > 
> > I have yaml as  follows: 
> > deliveries: 
> > - releases: 
> >   - latest_Rel: 
> >     - aaa: 
> >         file_name: some.tar 
> >         md5: xxxxxxxxxxxxxxx 
> >         product_name: aaa 
> >         product_number: aaa 902 8057 
> >         release_candidate: Rel 
> >         version: 25.1.1 
> >     - bbb: 
> >         file_name: some1.tar 
> >         md5: xxxxxxxxxxxxx 
> >         product_name: bbb 
> >         product_number: bbb 903 6746 
> >         release_candidate: Rel 
> >         version: 25.0.0 
> >     - abc: 
> >         file_name: some2.gz 
> >         md5: xxxxxxx 
> >         product_name: abc 
> >         product_number: None 
> >         release_candidate: None 
> >         version: ABC 
> >     - abd: 
> >         file_name: some3.tar 
> >         md5: xxxxxx 
> >         product_name: abd 
> >         product_number: abd 902 7815 
> >         release_candidate: Rel 
> >         version: 25.1.1 
> >     - abe: 
> >         file_name: some4.gz 
> >         md5: xxxxxxxxxxxxxxxxx 
> >         product_name: abe 
> >         product_number: abe 123 456 
> >         release_candidate: Rel 
> >         version: 25.1.1 
> > 
> > 
> > I want to write a playbook to  extract "file name: " tar files  which is 
> having version 25.1.1. 
> > Pls help 
>
> Start here: 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html 
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c5dc9d75-d78e-4c1b-8781-6bea74635ab6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to