I didn't have any idea you could do that sort of things - thank you. It
worked perfectly.
On Thursday, November 16, 2023 at 8:03:17 AM UTC-5 Dick Visser wrote:
> Instead of looping over all interfaces and applying a condition to each
> iteration, you can also filter the list to not include those names.
> It will be cleaner for your output as well. So instead of:
>
> with_items: "{{ ansible_interfaces }}"
>
> You could do:
>
> with_items: "{{ ansible_interfaces | reject('search','^veth') }}"
>
>
> Dick
>
> On Thu, 16 Nov 2023 at 12:23, Kathy L <[email protected]> wrote:
>
>> I'm having a problem Docker interface problems while getting a list of
>> interfaces. People on here helped me get the list of interfaces on a device
>> (thank you) like this:
>>
>> lineinfile:
>> dest: "data.txt"
>> line: "{{ item }}: {{ ansible_facts[item].ipv4.address }}"
>> insertafter: EOF
>> delegate_to: 127.0.0.1
>> with_items: "{{ ansible_interfaces }}"
>>
>> The problem is when docker is running, it creates interfaces like this:
>>
>> veth[UNIQUE ID]
>>
>> and they don't have IP addresses. How do I ignore the interface
>> beginning with veth?
>> I've tried this:
>>
>> when: "{{ item }} == "^vether"
>>
>> and
>> when: "{{ item }} = "vether.?"
>>
>> but neither works. How would I do this?
>>
>> --
>> 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/42a382d4-5709-4b2c-9e98-a5512f507da8n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/42a382d4-5709-4b2c-9e98-a5512f507da8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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/80ffc86a-dcad-4863-bf35-f434c39cb95an%40googlegroups.com.