59e311
From 840d6f7ca86fe9822c613f0f2c21f136271ce3b6 Mon Sep 17 00:00:00 2001
59e311
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
Date: Thu, 19 May 2022 15:44:03 +0200
59e311
Subject: [PATCH 2/5] Use Network-Manager and Netplan as default renderers for
59e311
 RHEL and Fedora (#1465)
59e311
59e311
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
RH-MergeRequest: 24: Add native NetworkManager support (#1224)
59e311
RH-Commit: [2/3] e33081b15a8558967bb480ed659116e7e0872840 (eesposit/cloud-init-centos-)
59e311
RH-Bugzilla: 2056964
59e311
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
59e311
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
59e311
59e311
commit 7703aa98b89c8daba207c28a0422268ead10019a
59e311
Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
Date:   Thu May 19 15:05:01 2022 +0200
59e311
59e311
    Use Network-Manager and Netplan as default renderers for RHEL and Fedora (#1465)
59e311
59e311
    This is adapted from Neal Gompa's PR:
59e311
    https://github.com/canonical/cloud-init/pull/1435
59e311
59e311
    The only difference is that we are not modifying renderers.py (thus
59e311
    modifying the priority of all distros), but just tweaking cloud.cfg to
59e311
    apply this change to Fedora and RHEL. Other distros can optionally
59e311
    add themselves afterwards.
59e311
59e311
            net: Prefer Netplan and NetworkManager renderers by default
59e311
59e311
            NetworkManager is used by default on a variety of Linux distributions,
59e311
            and exists as a cross-distribution network management service.
59e311
59e311
            Additionally, add information about the NetworkManager renderer to
59e311
            the cloud-init documentation.
59e311
59e311
            Because Netplan can be explicitly used to manage NetworkManager,
59e311
            it needs to be preferred before NetworkManager.
59e311
59e311
            This change is a follow-up to #1224, which added the native
59e311
            NetworkManager renderer.
59e311
            This patch has been deployed on Fedora's cloud-init package throughout
59e311
            the development of Fedora Linux 36 to verify that it works.
59e311
59e311
            This should also make it tremendously easier for Linux distributions
59e311
            to use cloud-init because now a standard configuration is supported
59e311
            by default.
59e311
59e311
            Signed-off-by: Neal Gompa <ngompa13@gmail.com>
59e311
59e311
    Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
59e311
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
---
59e311
 config/cloud.cfg.tmpl             |  3 +++
59e311
 doc/rtd/topics/network-config.rst | 12 +++++++++++-
59e311
 2 files changed, 14 insertions(+), 1 deletion(-)
59e311
59e311
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
59e311
index fb4b456c..86beee3c 100644
59e311
--- a/config/cloud.cfg.tmpl
59e311
+++ b/config/cloud.cfg.tmpl
59e311
@@ -330,4 +330,7 @@ system_info:
59e311
 {% elif variant in ["dragonfly"] %}
59e311
    network:
59e311
       renderers: ['freebsd']
59e311
+{% elif variant in ["rhel", "fedora"] %}
59e311
+   network:
59e311
+      renderers: ['netplan', 'network-manager', 'networkd', 'sysconfig', 'eni']
59e311
 {% endif %}
59e311
diff --git a/doc/rtd/topics/network-config.rst b/doc/rtd/topics/network-config.rst
59e311
index c461a3fe..f503caab 100644
59e311
--- a/doc/rtd/topics/network-config.rst
59e311
+++ b/doc/rtd/topics/network-config.rst
59e311
@@ -188,6 +188,15 @@ generated configuration into an internal network configuration state. From
59e311
 this state `Cloud-init`_ delegates rendering of the configuration to Distro
59e311
 supported formats.  The following ``renderers`` are supported in cloud-init:
59e311
 
59e311
+- **NetworkManager**
59e311
+
59e311
+`NetworkManager <https://networkmanager.dev>`_ is the standard Linux network
59e311
+configuration tool suite. It supports a wide range of networking setups.
59e311
+Configuration is typically stored in ``/etc/NetworkManager``.
59e311
+
59e311
+It is the default for a number of Linux distributions, notably Fedora;
59e311
+CentOS/RHEL; and derivatives.
59e311
+
59e311
 - **ENI**
59e311
 
59e311
 /etc/network/interfaces or ``ENI`` is supported by the ``ifupdown`` package
59e311
@@ -215,6 +224,7 @@ is as follows:
59e311
 - ENI
59e311
 - Sysconfig
59e311
 - Netplan
59e311
+- NetworkManager
59e311
 
59e311
 When applying the policy, `Cloud-init`_ checks if the current instance has the
59e311
 correct binaries and paths to support the renderer.  The first renderer that
59e311
@@ -223,7 +233,7 @@ supplying an updated configuration in cloud-config. ::
59e311
 
59e311
   system_info:
59e311
     network:
59e311
-      renderers: ['netplan', 'eni', 'sysconfig', 'freebsd', 'netbsd', 'openbsd']
59e311
+      renderers: ['netplan', 'network-manager', 'eni', 'sysconfig', 'freebsd', 'netbsd', 'openbsd']
59e311
 
59e311
 
59e311
 Network Configuration Tools
59e311
-- 
59e311
2.31.1
59e311