--- - name: get int name shell: ip -o addr show to {{ item }} | awk '{print $2}' register: int_name - name: add interface ip blockinfile: path: /etc/frr/frr.conf block: | ! interface {{ int_name.stdout }} ip address {{ item }} ip ospf cost 20 exit marker: "" notify: restart frr