FreeKB - Ansible split (cut a string into pieces)
www.freekb.net › ArticleJun 18, 2021 · - name: list the contents of the /tmp directory shell: ls /tmp register: out . Here is how you would use split with register output. - name: split at a single whitespace, print field 1 debug: msg: "{{ out.stdout.split(' ')[0] }}" The set_fact module can be used to create a variable that contains the split value.