Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • msg The task includes an option with an undefined variable.

    Posted on

    Hi Everyone !

    I'm missing something on this playbook based on RedHat article to replace ethx to emx interface...

    The error was: 'dict object' has no attribute 'macaddress'

    -name: Update udev rules


    • name: Rename network interfaces
      hosts: all
      become: true
      vars:
      src_prefix: "eth"
      dst_prefix: "ens"
      osnet_conf: "/etc/os-net-config/config.json"
      src_interfaces: "{{ ansible_interfaces | select('match', src_prefix ~ '.*') | sort | list }}"
      undercloud_conf: "~/undercloud.conf"
      tasks:

      • debug:
        msg: "{{ src_interfaces }}"

      • name: Update udev rules
        tags:

        • udev
          lineinfile:
          line: >
          SUBSYSTEM=="net",
          ACTION=="add",
          DRIVERS=="?",
          ATTR{address}=="{{ ansible_facts[item]['perm_macaddress'] | default(ansible_facts[item]['macaddress']) }}",
          NAME="{{ item | replace(src_prefix, dst_prefix) }}"
          path: /etc/udev/rules.d/70-rhosp-persistent-net.rules
          create: true
          with_items: "{{ src_interfaces | reject('match', '^.
          \..*$') | list }}"

    Attachments

    by

    points

    Responses

    Red Hat

    Quick Links

    Help

    Site Info

    Related Sites

    © 2025 Red Hat, Inc.