59e311
From 7daf47d1ee60a132244f2a9ec4e89ad496c32c3e Mon Sep 17 00:00:00 2001
59e311
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
Date: Mon, 28 Mar 2022 14:08:05 +0200
c36ff1
Subject: Add initial redhat setup
c36ff1
59e311
Merged patches (22.1):
59e311
- 70f80f82 Use _systemdgeneratordir macro for cloud-init-generator handling
59e311
- 0f74e7b8 Add dhcp-client as a dependency
59e311
- 791eb2b6 Report full specific version with "cloud-init --version"
59e311
- 865805d6 source-git: Use dynamic SRPM_NAME
59e311
- 45ddc666 add the drop-in also in the %files section of cloud-init.spec
59e311
- 08d939b2 Add gdisk and openssl as deps to fix UEFI / Azure initialization
59e311
- 0531cd68 Add netifaces package as a Requires in cloud-init.spec.template
59e311
59e311
Conflicts:
59e311
- .gitignore
59e311
- cloudinit/config/cc_chef.py = use double quotes instead of single quotes
59e311
- cloudinit/settings.py = use rhel settings
59e311
- cloudinit/sources/DataSourceAzure.py = remove temporary_hostname and helper
59e311
- requirements.txt = just add netifaces and not jsonschema dep
59e311
- setup.py = use double quotes instead of single quotes
59e311
59e311
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
59e311
c36ff1
Merged patches (RHEL-9/21.1):
c36ff1
- 5688a1d0 Removing python-nose and python-tox as dependency
c36ff1
- 237d57f9 Removing mock dependency
c36ff1
- d1c2f496 Removing python-jsonschema dependency
c36ff1
- 0d1cd14c Don't override default network configuration
c36ff1
c36ff1
Merged patches (21.1):
c36ff1
- 915d30ad Change gating file to correct rhel version
c36ff1
- 311f318d Removing net-tools dependency
c36ff1
- 74731806 Adding man pages to Red Hat spec file
c36ff1
- 758d333d Removing blocking test from yaml configuration file
c36ff1
- c7e7c59c Changing permission of cloud-init-generator to 755
c36ff1
- 8b85abbb Installing man pages in the correct place with correct permissions
c36ff1
- c6808d8d Fix unit failure of cloud-final.service if NetworkManager was not present.
c36ff1
- 11866ef6 Report full specific version with "cloud-init --version"
c36ff1
c36ff1
Rebase notes (18.5):
c36ff1
- added bash_completition file
c36ff1
- added cloud-id file
c36ff1
c36ff1
Merged patches (20.3):
c36ff1
- 01900d0 changing ds-identify patch from /usr/lib to /usr/libexec
c36ff1
- 7f47ca3 Render the generator from template instead of cp
c36ff1
c36ff1
Merged patches (19.4):
c36ff1
- 4ab5a61 Fix for network configuration not persisting after reboot
c36ff1
- 84cf125 Removing cloud-user from wheel
c36ff1
- 31290ab Adding gating tests for Azure, ESXi and AWS
c36ff1
c36ff1
Merged patches (18.5):
c36ff1
- 2d6b469 add power-state-change module to cloud_final_modules
c36ff1
- 764159f Adding systemd mount options to wait for cloud-init
c36ff1
- da4d99e Adding disk_setup to rhel/cloud.cfg
c36ff1
- f5c6832 Enable cloud-init by default on vmware
c36ff1
c36ff1
Conflicts:
c36ff1
cloudinit/config/cc_chef.py:
59e311
- Updated header documentation text
59e311
- Replacing double quotes by simple quotes
c36ff1
c36ff1
setup.py:
59e311
- Adding missing cmdclass info
c36ff1
c36ff1
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
c36ff1
c36ff1
Changes:
c36ff1
- move redhat to .distro to use new build script structure
c36ff1
- Fixing changelog for RHEL 9
c36ff1
c36ff1
Merged patches (21.1):
c36ff1
- 69bd7f71 DataSourceAzure.py: use hostnamectl to set hostname
c36ff1
- 0407867e Remove race condition between cloud-init and NetworkManager
c36ff1
c36ff1
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
c36ff1
---
c36ff1
 .distro/.gitignore                    |   1 +
59e311
 .distro/Makefile                      |  74 ++++
59e311
 .distro/Makefile.common               |  20 +
c36ff1
 .distro/cloud-init-tmpfiles.conf      |   1 +
59e311
 .distro/cloud-init.spec.template      | 505 ++++++++++++++++++++++++++
c36ff1
 .distro/gating.yaml                   |   8 +
c36ff1
 .distro/rpmbuild/BUILD/.gitignore     |   3 +
c36ff1
 .distro/rpmbuild/RPMS/.gitignore      |   3 +
c36ff1
 .distro/rpmbuild/SOURCES/.gitignore   |   3 +
c36ff1
 .distro/rpmbuild/SPECS/.gitignore     |   3 +
c36ff1
 .distro/rpmbuild/SRPMS/.gitignore     |   3 +
c36ff1
 .distro/scripts/frh.py                |  27 ++
59e311
 .distro/scripts/git-backport-diff     | 327 +++++++++++++++++
59e311
 .distro/scripts/git-compile-check     | 215 +++++++++++
59e311
 .distro/scripts/process-patches.sh    |  88 +++++
c36ff1
 .distro/scripts/tarball_checksum.sh   |   3 +
c36ff1
 .gitignore                            |   1 +
59e311
 cloudinit/config/cc_chef.py           |  65 +++-
59e311
 cloudinit/settings.py                 |  21 +-
c36ff1
 requirements.txt                      |   3 -
c36ff1
 rhel/README.rhel                      |   5 +
c36ff1
 rhel/cloud-init-tmpfiles.conf         |   1 +
59e311
 rhel/cloud.cfg                        |  69 ++++
59e311
 rhel/systemd/cloud-config.service     |  18 +
c36ff1
 rhel/systemd/cloud-config.target      |  11 +
c36ff1
 rhel/systemd/cloud-final.service      |  24 ++
59e311
 rhel/systemd/cloud-init-local.service |  31 ++
c36ff1
 rhel/systemd/cloud-init.service       |  26 ++
c36ff1
 rhel/systemd/cloud-init.target        |   7 +
59e311
 setup.py                              |  28 +-
c36ff1
 tools/read-version                    |  28 +-
59e311
 31 files changed, 1557 insertions(+), 65 deletions(-)
c36ff1
 create mode 100644 .distro/.gitignore
c36ff1
 create mode 100644 .distro/Makefile
c36ff1
 create mode 100644 .distro/Makefile.common
c36ff1
 create mode 100644 .distro/cloud-init-tmpfiles.conf
c36ff1
 create mode 100644 .distro/cloud-init.spec.template
c36ff1
 create mode 100644 .distro/gating.yaml
c36ff1
 create mode 100644 .distro/rpmbuild/BUILD/.gitignore
c36ff1
 create mode 100644 .distro/rpmbuild/RPMS/.gitignore
c36ff1
 create mode 100644 .distro/rpmbuild/SOURCES/.gitignore
c36ff1
 create mode 100644 .distro/rpmbuild/SPECS/.gitignore
c36ff1
 create mode 100644 .distro/rpmbuild/SRPMS/.gitignore
c36ff1
 create mode 100755 .distro/scripts/frh.py
c36ff1
 create mode 100755 .distro/scripts/git-backport-diff
c36ff1
 create mode 100755 .distro/scripts/git-compile-check
c36ff1
 create mode 100755 .distro/scripts/process-patches.sh
c36ff1
 create mode 100755 .distro/scripts/tarball_checksum.sh
c36ff1
 create mode 100644 rhel/README.rhel
c36ff1
 create mode 100644 rhel/cloud-init-tmpfiles.conf
c36ff1
 create mode 100644 rhel/cloud.cfg
c36ff1
 create mode 100644 rhel/systemd/cloud-config.service
c36ff1
 create mode 100644 rhel/systemd/cloud-config.target
c36ff1
 create mode 100644 rhel/systemd/cloud-final.service
c36ff1
 create mode 100644 rhel/systemd/cloud-init-local.service
c36ff1
 create mode 100644 rhel/systemd/cloud-init.service
c36ff1
 create mode 100644 rhel/systemd/cloud-init.target
c36ff1
c36ff1
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
59e311
index fdb3a6e3..d028c548 100644
c36ff1
--- a/cloudinit/config/cc_chef.py
c36ff1
+++ b/cloudinit/config/cc_chef.py
c36ff1
@@ -6,7 +6,70 @@
c36ff1
 #
c36ff1
 # This file is part of cloud-init. See LICENSE file for license information.
c36ff1
 
c36ff1
-"""Chef: module that configures, starts and installs chef."""
c36ff1
+"""
c36ff1
+Chef
c36ff1
+----
c36ff1
+**Summary:** module that configures, starts and installs chef.
c36ff1
+
c36ff1
+This module enables chef to be installed (from packages or
c36ff1
+from gems, or from omnibus). Before this occurs chef configurations are
c36ff1
+written to disk (validation.pem, client.pem, firstboot.json, client.rb),
c36ff1
+and needed chef folders/directories are created (/etc/chef and /var/log/chef
c36ff1
+and so-on). Then once installing proceeds correctly if configured chef will
c36ff1
+be started (in daemon mode or in non-daemon mode) and then once that has
c36ff1
+finished (if ran in non-daemon mode this will be when chef finishes
c36ff1
+converging, if ran in daemon mode then no further actions are possible since
c36ff1
+chef will have forked into its own process) then a post run function can
c36ff1
+run that can do finishing activities (such as removing the validation pem
c36ff1
+file).
c36ff1
+
c36ff1
+**Internal name:** ``cc_chef``
c36ff1
+
c36ff1
+**Module frequency:** per always
c36ff1
+
c36ff1
+**Supported distros:** all
c36ff1
+
c36ff1
+**Config keys**::
c36ff1
+
c36ff1
+    chef:
c36ff1
+       directories: (defaulting to /etc/chef, /var/log/chef, /var/lib/chef,
c36ff1
+                     /var/cache/chef, /var/backups/chef, /run/chef)
c36ff1
+       validation_cert: (optional string to be written to file validation_key)
c36ff1
+                        special value 'system' means set use existing file
c36ff1
+       validation_key: (optional the path for validation_cert. default
c36ff1
+                        /etc/chef/validation.pem)
c36ff1
+       firstboot_path: (path to write run_list and initial_attributes keys that
c36ff1
+                        should also be present in this configuration, defaults
c36ff1
+                        to /etc/chef/firstboot.json)
c36ff1
+       exec: boolean to run or not run chef (defaults to false, unless
c36ff1
+                                             a gem installed is requested
c36ff1
+                                             where this will then default
c36ff1
+                                             to true)
c36ff1
+
c36ff1
+    chef.rb template keys (if falsey, then will be skipped and not
c36ff1
+                           written to /etc/chef/client.rb)
c36ff1
+
c36ff1
+    chef:
c36ff1
+      client_key:
c36ff1
+      encrypted_data_bag_secret:
c36ff1
+      environment:
c36ff1
+      file_backup_path:
c36ff1
+      file_cache_path:
c36ff1
+      json_attribs:
c36ff1
+      log_level:
c36ff1
+      log_location:
c36ff1
+      node_name:
c36ff1
+      omnibus_url:
c36ff1
+      omnibus_url_retries:
c36ff1
+      omnibus_version:
c36ff1
+      pid_file:
c36ff1
+      server_url:
c36ff1
+      show_time:
c36ff1
+      ssl_verify_mode:
c36ff1
+      validation_cert:
c36ff1
+      validation_key:
c36ff1
+      validation_name:
c36ff1
+"""
c36ff1
 
c36ff1
 import itertools
c36ff1
 import json
c36ff1
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
59e311
index ecc1403b..a780e21e 100644
c36ff1
--- a/cloudinit/settings.py
c36ff1
+++ b/cloudinit/settings.py
59e311
@@ -48,16 +48,19 @@ CFG_BUILTIN = {
59e311
         # At the end to act as a 'catch' when none of the above work...
59e311
         "None",
c36ff1
     ],
59e311
-    "def_log_file": "/var/log/cloud-init.log",
59e311
-    "log_cfgs": [],
59e311
-    "syslog_fix_perms": ["syslog:adm", "root:adm", "root:wheel", "root:root"],
59e311
-    "system_info": {
59e311
-        "paths": {
59e311
-            "cloud_dir": "/var/lib/cloud",
59e311
-            "templates_dir": "/etc/cloud/templates/",
59e311
+    'def_log_file': '/var/log/cloud-init.log',
59e311
+    'log_cfgs': [],
c36ff1
+    'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
c36ff1
+    'ssh_deletekeys': False,
c36ff1
+    'ssh_genkeytypes': [],
c36ff1
+    'syslog_fix_perms': [],
59e311
+    'system_info': {
59e311
+        'paths': {
59e311
+            'cloud_dir': '/var/lib/cloud',
59e311
+            'templates_dir': '/etc/cloud/templates/',
c36ff1
         },
59e311
-        "distro": "ubuntu",
59e311
-        "network": {"renderers": None},
c36ff1
+        'distro': 'rhel',
59e311
+        'network': {'renderers': None},
c36ff1
     },
59e311
     "vendor_data": {"enabled": True, "prefix": []},
59e311
     "vendor_data2": {"enabled": True, "prefix": []},
c36ff1
diff --git a/requirements.txt b/requirements.txt
59e311
index c4adc455..f77f1d73 100644
c36ff1
--- a/requirements.txt
c36ff1
+++ b/requirements.txt
59e311
@@ -30,9 +30,6 @@ requests
c36ff1
 # For patching pieces of cloud-config together
c36ff1
 jsonpatch
59e311
 
c36ff1
-# For validating cloud-config sections per schema definitions
c36ff1
-jsonschema
59e311
-
59e311
 # Used by DataSourceVMware to inspect the host's network configuration during
59e311
 # the "setup()" function.
59e311
 #
c36ff1
diff --git a/rhel/README.rhel b/rhel/README.rhel
c36ff1
new file mode 100644
c36ff1
index 00000000..aa29630d
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/README.rhel
c36ff1
@@ -0,0 +1,5 @@
c36ff1
+The following cloud-init modules are currently unsupported on this OS:
c36ff1
+ - apt_update_upgrade ('apt_update', 'apt_upgrade', 'apt_mirror', 'apt_preserve_sources_list', 'apt_old_mirror', 'apt_sources', 'debconf_selections', 'packages' options)
c36ff1
+ - byobu ('byobu_by_default' option)
c36ff1
+ - chef
c36ff1
+ - grub_dpkg
c36ff1
diff --git a/rhel/cloud-init-tmpfiles.conf b/rhel/cloud-init-tmpfiles.conf
c36ff1
new file mode 100644
c36ff1
index 00000000..0c6d2a3b
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/cloud-init-tmpfiles.conf
c36ff1
@@ -0,0 +1 @@
c36ff1
+d /run/cloud-init 0700 root root - -
c36ff1
diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg
c36ff1
new file mode 100644
c36ff1
index 00000000..9ecba215
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/cloud.cfg
c36ff1
@@ -0,0 +1,69 @@
c36ff1
+users:
c36ff1
+ - default
c36ff1
+
c36ff1
+disable_root: 1
c36ff1
+ssh_pwauth:   0
c36ff1
+
c36ff1
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
c36ff1
+resize_rootfs_tmp: /dev
c36ff1
+ssh_deletekeys:   1
c36ff1
+ssh_genkeytypes:  ~
c36ff1
+syslog_fix_perms: ~
c36ff1
+disable_vmware_customization: false
c36ff1
+
c36ff1
+cloud_init_modules:
c36ff1
+ - disk_setup
c36ff1
+ - migrator
c36ff1
+ - bootcmd
c36ff1
+ - write-files
c36ff1
+ - growpart
c36ff1
+ - resizefs
c36ff1
+ - set_hostname
c36ff1
+ - update_hostname
c36ff1
+ - update_etc_hosts
c36ff1
+ - rsyslog
c36ff1
+ - users-groups
c36ff1
+ - ssh
c36ff1
+
c36ff1
+cloud_config_modules:
c36ff1
+ - mounts
c36ff1
+ - locale
c36ff1
+ - set-passwords
c36ff1
+ - rh_subscription
c36ff1
+ - yum-add-repo
c36ff1
+ - package-update-upgrade-install
c36ff1
+ - timezone
c36ff1
+ - puppet
c36ff1
+ - chef
c36ff1
+ - salt-minion
c36ff1
+ - mcollective
c36ff1
+ - disable-ec2-metadata
c36ff1
+ - runcmd
c36ff1
+
c36ff1
+cloud_final_modules:
c36ff1
+ - rightscale_userdata
c36ff1
+ - scripts-per-once
c36ff1
+ - scripts-per-boot
c36ff1
+ - scripts-per-instance
c36ff1
+ - scripts-user
c36ff1
+ - ssh-authkey-fingerprints
c36ff1
+ - keys-to-console
c36ff1
+ - phone-home
c36ff1
+ - final-message
c36ff1
+ - power-state-change
c36ff1
+
c36ff1
+system_info:
c36ff1
+  default_user:
c36ff1
+    name: cloud-user
c36ff1
+    lock_passwd: true
c36ff1
+    gecos: Cloud User
c36ff1
+    groups: [adm, systemd-journal]
c36ff1
+    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
c36ff1
+    shell: /bin/bash
c36ff1
+  distro: rhel
c36ff1
+  paths:
c36ff1
+    cloud_dir: /var/lib/cloud
c36ff1
+    templates_dir: /etc/cloud/templates
c36ff1
+  ssh_svcname: sshd
c36ff1
+
c36ff1
+# vim:syntax=yaml
c36ff1
diff --git a/rhel/systemd/cloud-config.service b/rhel/systemd/cloud-config.service
c36ff1
new file mode 100644
c36ff1
index 00000000..f3dcd4be
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-config.service
c36ff1
@@ -0,0 +1,18 @@
c36ff1
+[Unit]
c36ff1
+Description=Apply the settings specified in cloud-config
c36ff1
+After=network-online.target cloud-config.target
c36ff1
+Wants=network-online.target cloud-config.target
c36ff1
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
c36ff1
+ConditionKernelCommandLine=!cloud-init=disabled
c36ff1
+
c36ff1
+[Service]
c36ff1
+Type=oneshot
c36ff1
+ExecStart=/usr/bin/cloud-init modules --mode=config
c36ff1
+RemainAfterExit=yes
c36ff1
+TimeoutSec=0
c36ff1
+
c36ff1
+# Output needs to appear in instance console output
c36ff1
+StandardOutput=journal+console
c36ff1
+
c36ff1
+[Install]
c36ff1
+WantedBy=cloud-init.target
c36ff1
diff --git a/rhel/systemd/cloud-config.target b/rhel/systemd/cloud-config.target
c36ff1
new file mode 100644
c36ff1
index 00000000..ae9b7d02
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-config.target
c36ff1
@@ -0,0 +1,11 @@
c36ff1
+# cloud-init normally emits a "cloud-config" upstart event to inform third
c36ff1
+# parties that cloud-config is available, which does us no good when we're
c36ff1
+# using systemd.  cloud-config.target serves as this synchronization point
c36ff1
+# instead.  Services that would "start on cloud-config" with upstart can
c36ff1
+# instead use "After=cloud-config.target" and "Wants=cloud-config.target"
c36ff1
+# as appropriate.
c36ff1
+
c36ff1
+[Unit]
c36ff1
+Description=Cloud-config availability
c36ff1
+Wants=cloud-init-local.service cloud-init.service
c36ff1
+After=cloud-init-local.service cloud-init.service
c36ff1
diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service
c36ff1
new file mode 100644
c36ff1
index 00000000..e281c0cf
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-final.service
c36ff1
@@ -0,0 +1,24 @@
c36ff1
+[Unit]
c36ff1
+Description=Execute cloud user/final scripts
c36ff1
+After=network-online.target cloud-config.service rc-local.service
c36ff1
+Wants=network-online.target cloud-config.service
c36ff1
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
c36ff1
+ConditionKernelCommandLine=!cloud-init=disabled
c36ff1
+
c36ff1
+[Service]
c36ff1
+Type=oneshot
c36ff1
+ExecStart=/usr/bin/cloud-init modules --mode=final
c36ff1
+RemainAfterExit=yes
c36ff1
+TimeoutSec=0
c36ff1
+KillMode=process
c36ff1
+# Restart NetworkManager if it is present and running.
c36ff1
+ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
c36ff1
+ out=$(systemctl show --property=SubState $u) || exit; \
c36ff1
+ [ "$out" = "SubState=running" ] || exit 0; \
c36ff1
+ systemctl reload-or-try-restart $u'
c36ff1
+
c36ff1
+# Output needs to appear in instance console output
c36ff1
+StandardOutput=journal+console
c36ff1
+
c36ff1
+[Install]
c36ff1
+WantedBy=cloud-init.target
c36ff1
diff --git a/rhel/systemd/cloud-init-local.service b/rhel/systemd/cloud-init-local.service
c36ff1
new file mode 100644
c36ff1
index 00000000..8f9f6c9f
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-init-local.service
c36ff1
@@ -0,0 +1,31 @@
c36ff1
+[Unit]
c36ff1
+Description=Initial cloud-init job (pre-networking)
c36ff1
+DefaultDependencies=no
c36ff1
+Wants=network-pre.target
c36ff1
+After=systemd-remount-fs.service
c36ff1
+Requires=dbus.socket
c36ff1
+After=dbus.socket
c36ff1
+Before=NetworkManager.service network.service
c36ff1
+Before=network-pre.target
c36ff1
+Before=shutdown.target
c36ff1
+Before=firewalld.target
c36ff1
+Conflicts=shutdown.target
c36ff1
+RequiresMountsFor=/var/lib/cloud
c36ff1
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
c36ff1
+ConditionKernelCommandLine=!cloud-init=disabled
c36ff1
+
c36ff1
+[Service]
c36ff1
+Type=oneshot
c36ff1
+ExecStartPre=/bin/mkdir -p /run/cloud-init
c36ff1
+ExecStartPre=/sbin/restorecon /run/cloud-init
c36ff1
+ExecStartPre=/usr/bin/touch /run/cloud-init/enabled
c36ff1
+ExecStart=/usr/bin/cloud-init init --local
c36ff1
+ExecStart=/bin/touch /run/cloud-init/network-config-ready
c36ff1
+RemainAfterExit=yes
c36ff1
+TimeoutSec=0
c36ff1
+
c36ff1
+# Output needs to appear in instance console output
c36ff1
+StandardOutput=journal+console
c36ff1
+
c36ff1
+[Install]
c36ff1
+WantedBy=cloud-init.target
c36ff1
diff --git a/rhel/systemd/cloud-init.service b/rhel/systemd/cloud-init.service
c36ff1
new file mode 100644
c36ff1
index 00000000..0b3d796d
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-init.service
c36ff1
@@ -0,0 +1,26 @@
c36ff1
+[Unit]
c36ff1
+Description=Initial cloud-init job (metadata service crawler)
c36ff1
+Wants=cloud-init-local.service
c36ff1
+Wants=sshd-keygen.service
c36ff1
+Wants=sshd.service
c36ff1
+After=cloud-init-local.service
c36ff1
+After=NetworkManager.service network.service
c36ff1
+After=NetworkManager-wait-online.service
c36ff1
+Before=network-online.target
c36ff1
+Before=sshd-keygen.service
c36ff1
+Before=sshd.service
c36ff1
+Before=systemd-user-sessions.service
c36ff1
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
c36ff1
+ConditionKernelCommandLine=!cloud-init=disabled
c36ff1
+
c36ff1
+[Service]
c36ff1
+Type=oneshot
c36ff1
+ExecStart=/usr/bin/cloud-init init
c36ff1
+RemainAfterExit=yes
c36ff1
+TimeoutSec=0
c36ff1
+
c36ff1
+# Output needs to appear in instance console output
c36ff1
+StandardOutput=journal+console
c36ff1
+
c36ff1
+[Install]
c36ff1
+WantedBy=cloud-init.target
c36ff1
diff --git a/rhel/systemd/cloud-init.target b/rhel/systemd/cloud-init.target
c36ff1
new file mode 100644
c36ff1
index 00000000..083c3b6f
c36ff1
--- /dev/null
c36ff1
+++ b/rhel/systemd/cloud-init.target
c36ff1
@@ -0,0 +1,7 @@
c36ff1
+# cloud-init target is enabled by cloud-init-generator
c36ff1
+# To disable it you can either:
c36ff1
+#  a.) boot with kernel cmdline of 'cloud-init=disabled'
c36ff1
+#  b.) touch a file /etc/cloud/cloud-init.disabled
c36ff1
+[Unit]
c36ff1
+Description=Cloud-init target
c36ff1
+After=multi-user.target
c36ff1
diff --git a/setup.py b/setup.py
59e311
index a9132d2c..3c377eaa 100755
c36ff1
--- a/setup.py
c36ff1
+++ b/setup.py
59e311
@@ -139,21 +139,6 @@ INITSYS_FILES = {
59e311
     "sysvinit_deb": [f for f in glob("sysvinit/debian/*") if is_f(f)],
59e311
     "sysvinit_openrc": [f for f in glob("sysvinit/gentoo/*") if is_f(f)],
59e311
     "sysvinit_suse": [f for f in glob("sysvinit/suse/*") if is_f(f)],
59e311
-    "systemd": [
59e311
-        render_tmpl(f)
59e311
-        for f in (
59e311
-            glob("systemd/*.tmpl")
59e311
-            + glob("systemd/*.service")
59e311
-            + glob("systemd/*.socket")
59e311
-            + glob("systemd/*.target")
59e311
-        )
59e311
-        if (is_f(f) and not is_generator(f))
59e311
-    ],
59e311
-    "systemd.generators": [
c36ff1
-        render_tmpl(f, mode=0o755)
59e311
-        for f in glob("systemd/*")
59e311
-        if is_f(f) and is_generator(f)
59e311
-    ],
59e311
     "upstart": [f for f in glob("upstart/*") if is_f(f)],
c36ff1
 }
c36ff1
 INITSYS_ROOTS = {
59e311
@@ -163,10 +148,6 @@ INITSYS_ROOTS = {
59e311
     "sysvinit_deb": "etc/init.d",
59e311
     "sysvinit_openrc": "etc/init.d",
59e311
     "sysvinit_suse": "etc/init.d",
59e311
-    "systemd": pkg_config_read("systemd", "systemdsystemunitdir"),
59e311
-    "systemd.generators": pkg_config_read(
59e311
-        "systemd", "systemdsystemgeneratordir"
59e311
-    ),
59e311
     "upstart": "etc/init/",
c36ff1
 }
c36ff1
 INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()])
59e311
@@ -281,15 +262,13 @@ data_files = [
59e311
     (
59e311
         USR_LIB_EXEC + "/cloud-init",
59e311
         [
59e311
-            "tools/ds-identify",
59e311
             "tools/hook-hotplug",
59e311
             "tools/uncloud-init",
59e311
             "tools/write-ssh-key-fingerprints",
59e311
         ],
59e311
     ),
59e311
     (
59e311
-        USR + "/share/bash-completion/completions",
59e311
-        ["bash_completion/cloud-init"],
59e311
+        ETC + "/bash_completion.d", ["bash_completion/cloud-init"],
59e311
     ),
59e311
     (USR + "/share/doc/cloud-init", [f for f in glob("doc/*") if is_f(f)]),
59e311
     (
59e311
@@ -308,8 +287,7 @@ if not platform.system().endswith("BSD"):
59e311
                 ETC + "/NetworkManager/dispatcher.d/",
59e311
                 ["tools/hook-network-manager"],
59e311
             ),
59e311
-            (ETC + "/dhcp/dhclient-exit-hooks.d/", ["tools/hook-dhclient"]),
59e311
-            (LIB + "/udev/rules.d", [f for f in glob("udev/*.rules")]),
59e311
+            ("/usr/lib/udev/rules.d", [f for f in glob("udev/*.rules")]),
59e311
             (
59e311
                 ETC + "/systemd/system/sshd-keygen@.service.d/",
59e311
                 ["systemd/disable-sshd-keygen-if-cloud-init-active.conf"],
59e311
@@ -339,8 +317,6 @@ setuptools.setup(
59e311
     scripts=["tools/cloud-init-per"],
59e311
     license="Dual-licensed under GPLv3 or Apache 2.0",
c36ff1
     data_files=data_files,
c36ff1
-    install_requires=requirements,
c36ff1
-    cmdclass=cmdclass,
c36ff1
     entry_points={
59e311
         "console_scripts": [
59e311
             "cloud-init = cloudinit.cmd.main:main",
c36ff1
diff --git a/tools/read-version b/tools/read-version
c36ff1
index 02c90643..79755f78 100755
c36ff1
--- a/tools/read-version
c36ff1
+++ b/tools/read-version
c36ff1
@@ -71,32 +71,8 @@ version_long = None
c36ff1
 is_release_branch_ci = (
c36ff1
     os.environ.get("TRAVIS_PULL_REQUEST_BRANCH", "").startswith("upstream/")
c36ff1
 )
c36ff1
-if is_gitdir(_tdir) and which("git") and not is_release_branch_ci:
c36ff1
-    flags = []
c36ff1
-    if use_tags:
c36ff1
-        flags = ['--tags']
c36ff1
-    cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
c36ff1
-
c36ff1
-    try:
c36ff1
-        version = tiny_p(cmd).strip()
c36ff1
-    except RuntimeError:
c36ff1
-        version = None
c36ff1
-
c36ff1
-    if version is None or not version.startswith(src_version):
c36ff1
-        sys.stderr.write("git describe version (%s) differs from "
c36ff1
-                         "cloudinit.version (%s)\n" % (version, src_version))
c36ff1
-        sys.stderr.write(
c36ff1
-            "Please get the latest upstream tags.\n"
c36ff1
-            "As an example, this can be done with the following:\n"
c36ff1
-            "$ git remote add upstream https://git.launchpad.net/cloud-init\n"
c36ff1
-            "$ git fetch upstream --tags\n"
c36ff1
-        )
c36ff1
-        sys.exit(1)
c36ff1
-
c36ff1
-    version_long = tiny_p(cmd + ["--long"]).strip()
c36ff1
-else:
c36ff1
-    version = src_version
c36ff1
-    version_long = None
c36ff1
+version = src_version
c36ff1
+version_long = None
c36ff1
 
c36ff1
 # version is X.Y.Z[+xxx.gHASH]
c36ff1
 # version_long is None or X.Y.Z-xxx-gHASH
c36ff1
-- 
59e311
2.31.1
c36ff1