--- - name: Install networkd on Fedora when: ansible_distribution == "Fedora" become: true dnf: state: latest name: - systemd-resolved - systemd-networkd - name: Install networkd on CentOS 7 when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" become: true yum: state: latest name: - systemd-resolved - systemd-networkd - name: Install networkd on CentOS 8 when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8" become: true block: # The systemd-networkd EPEL package is currently in the testing phase, so we have # to enable the testing EPEL repo to install it. Note that this is also done in # the packages role # https://bugzilla.redhat.com/show_bug.cgi?id=1789146 - name: Enable EPEL-Testing repository on CentOS 8s lineinfile: path: /etc/yum.repos.d/epel-testing.repo regexp: "enabled=(0|1)" line: "enabled=1" insertbefore: "^$" firstmatch: true - name: Install networkd dnf: state: latest name: systemd-networkd