files_found_path is an array/list. So you need files_found_path[0].split

On Tue, May 23, 2023 at 5:42 AM Sameer Modak <[email protected]>
wrote:

> Hello Team,
>
> Code
>
> name: debug grepout
>
>     debug:
>
> #      msg: "this is the version {{ vername.files.path }}"
>
>       var: *files_found_path*
>
>     tags: vern
>
> Output:
>
> files_found_path": [
>
>         "/opt/confluent-7.2.5/kafka/share/java/kafka/kafka_2.13-*7.2.5*
> -ccs.jar"
>
>     ]
>
>
>  Above code is working but after that it failing with below code, i need
> *7.2.5* before -css in above output but failing to get that tried 
> *files_found_path[0].split(‘-‘)
> as well*
>
>  - name: get version
>
>     set_fact:
>
>       versionn: "{{ *files_found_path.split(‘-‘)[0] *}}"
>
> TASK [get version]
> ***************************************************************************************************************************************************************************
>
> fatal: [host1: FAILED! => {"msg": "The task includes an option with an
> undefined variable. The error was: 'list object' has no attribute 'split'.
> 'list object' has no attribute 'split'\n\nThe error appears to be in
> '/Users/sameer_modak/ansibledemo/testing.yml': line 54, column 5, but
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
> offending line appears to be:\n\n\n  - name: get version\n    ^ here\n"}
>
> fatal: [host2]: FAILED! => {"msg": "The task includes an option with an
> undefined variable. The error was: 'list object' has no attribute 'split'.
> 'list object' has no attribute 'split'\n\nThe error appears to be in
> '/Users/sameer_modak/ansibledemo/testing.yml': line 54, column 5, but
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
> offending line appears to be:\n\n\n  - name: get version\n    ^ here\n"}
>
> fatal: [host3]: FAILED! => {"msg": "The task includes an option with an
> undefined variable. The error was: 'list object' has no attribute 'split'.
> 'list object' has no a
>
>
>
> Thanks in advance.
>
> --
> 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/9e09186d-7715-49d7-ad37-b8f41feebac7n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9e09186d-7715-49d7-ad37-b8f41feebac7n%40googlegroups.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/CAFwWkHo2vb9La5vyzx-N37UmtcCr4EAMnambGqumzHYj3Kv%2BMA%40mail.gmail.com.

Reply via email to