sailesh1993 / rpms / cloud-init

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