Filter values

Hello Everyone,
I want to filter out the values after “:” so I can pass the RestAPI commands to add the devices.

  • name: Split All - FIRST
    set_fact:
    names_list: “{{ get_names.content.split(‘\n’) | regex_replace(‘( =)’, ‘:’) }}”
    macs_list: “{{ get_macs.content.split(‘\n’) | regex_replace(‘( =)’, ‘:’) }}”
    descriptions_list: “{{ get_descriptions.content.split(‘\n’) | regex_replace(‘( =)’, ‘:’) }}”

  • name: FileCreate
    lineinfile:
    path: debugfile.log
    insertafter: EOF
    create: yes
    line: “FIRST - {{ item.0 }}, SECOND - {{ item.1 }}, THIRD - {{ item.2 }}”
    loop: “{{ data[0]|zip(*data[1:])|list }}”
    vars:
    data:

  • ‘{{ names_list }}’

  • ‘{{ macs_list }}’

  • ‘{{ descriptions_list }}’

Here’s the output of the lineinfile -

FIRST - sw01 GigabitEthernet0/0 IF-MIB.ifName: GigabitEthernet0/0, SECOND - sw01 GigabitEthernet0/0 IF-MIB.ifPhysAddress: 0001e896655b, THIRD - sw01 GigabitEthernet0/0 IF-MIB.ifDescr: GigabitEthernet 0/0

Please advise how can I split or filter the first part.

Thanks