d9e4dd
From 4b84d29211b7b2121afe9045c71ded5381536d8b Mon Sep 17 00:00:00 2001
d9e4dd
From: Eduardo Otubo <otubo@redhat.com>
d9e4dd
Date: Fri, 7 May 2021 13:36:03 +0200
d9e4dd
Subject: Add initial redhat setup
d9e4dd
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:
d9e4dd
 - Updated header documentation text
d9e4dd
 - Replacing double quotes by simple quotes
d9e4dd
d9e4dd
setup.py:
d9e4dd
 - 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 +
d9e4dd
 .distro/Makefile                      |  74 +++++
d9e4dd
 .distro/Makefile.common               |  30 ++
d9e4dd
 .distro/cloud-init-tmpfiles.conf      |   1 +
d9e4dd
 .distro/cloud-init.spec.template      | 383 ++++++++++++++++++++++++++
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 ++
d9e4dd
 .distro/scripts/git-backport-diff     | 327 ++++++++++++++++++++++
d9e4dd
 .distro/scripts/git-compile-check     | 215 +++++++++++++++
d9e4dd
 .distro/scripts/process-patches.sh    |  88 ++++++
d9e4dd
 .distro/scripts/tarball_checksum.sh   |   3 +
d9e4dd
 .gitignore                            |   1 +
d9e4dd
 cloudinit/config/cc_chef.py           |  67 ++++-
d9e4dd
 cloudinit/settings.py                 |   7 +-
d9e4dd
 cloudinit/sources/DataSourceAzure.py  |   2 +-
d9e4dd
 requirements.txt                      |   3 -
d9e4dd
 rhel/README.rhel                      |   5 +
d9e4dd
 rhel/cloud-init-tmpfiles.conf         |   1 +
d9e4dd
 rhel/cloud.cfg                        |  69 +++++
d9e4dd
 rhel/systemd/cloud-config.service     |  18 ++
d9e4dd
 rhel/systemd/cloud-config.target      |  11 +
d9e4dd
 rhel/systemd/cloud-final.service      |  24 ++
d9e4dd
 rhel/systemd/cloud-init-local.service |  31 +++
d9e4dd
 rhel/systemd/cloud-init.service       |  26 ++
d9e4dd
 rhel/systemd/cloud-init.target        |   7 +
d9e4dd
 setup.py                              |  23 +-
d9e4dd
 tools/read-version                    |  28 +-
d9e4dd
 32 files changed, 1441 insertions(+), 54 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
d9e4dd
index aaf71366..97ef649a 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
@@ -31,7 +94,7 @@ CHEF_DIRS = tuple([
d9e4dd
     '/var/lib/chef',
d9e4dd
     '/var/cache/chef',
d9e4dd
     '/var/backups/chef',
d9e4dd
-    '/var/run/chef',
d9e4dd
+    '/run/chef',
d9e4dd
 ])
d9e4dd
 REQUIRED_CHEF_DIRS = tuple([
d9e4dd
     '/etc/chef',
d9e4dd
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
d9e4dd
index 91e1bfe7..e690c0fd 100644
d9e4dd
--- a/cloudinit/settings.py
d9e4dd
+++ b/cloudinit/settings.py
d9e4dd
@@ -47,13 +47,16 @@ CFG_BUILTIN = {
d9e4dd
     ],
d9e4dd
     'def_log_file': '/var/log/cloud-init.log',
d9e4dd
     'log_cfgs': [],
d9e4dd
-    'syslog_fix_perms': ['syslog:adm', 'root:adm', 'root:wheel', 'root:root'],
d9e4dd
+    'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
d9e4dd
+    'ssh_deletekeys': False,
d9e4dd
+    'ssh_genkeytypes': [],
d9e4dd
+    'syslog_fix_perms': [],
d9e4dd
     'system_info': {
d9e4dd
         'paths': {
d9e4dd
             'cloud_dir': '/var/lib/cloud',
d9e4dd
             'templates_dir': '/etc/cloud/templates/',
d9e4dd
         },
d9e4dd
-        'distro': 'ubuntu',
d9e4dd
+        'distro': 'rhel',
d9e4dd
         'network': {'renderers': None},
d9e4dd
     },
d9e4dd
     'vendor_data': {'enabled': True, 'prefix': []},
d9e4dd
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
d9e4dd
index cee630f7..553b5a7e 100755
d9e4dd
--- a/cloudinit/sources/DataSourceAzure.py
d9e4dd
+++ b/cloudinit/sources/DataSourceAzure.py
d9e4dd
@@ -296,7 +296,7 @@ def get_hostname(hostname_command='hostname'):
d9e4dd
 
d9e4dd
 
d9e4dd
 def set_hostname(hostname, hostname_command='hostname'):
d9e4dd
-    subp.subp([hostname_command, hostname])
d9e4dd
+    util.subp(['hostnamectl', 'set-hostname', str(hostname)])
d9e4dd
 
d9e4dd
 
d9e4dd
 @azure_ds_telemetry_reporter
d9e4dd
diff --git a/requirements.txt b/requirements.txt
d9e4dd
index 5817da3b..5b8becd7 100644
d9e4dd
--- a/requirements.txt
d9e4dd
+++ b/requirements.txt
d9e4dd
@@ -29,6 +29,3 @@ requests
d9e4dd
 
d9e4dd
 # For patching pieces of cloud-config together
d9e4dd
 jsonpatch
d9e4dd
-
d9e4dd
-# For validating cloud-config sections per schema definitions
d9e4dd
-jsonschema
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
d9e4dd
index cbacf48e..d5cd01a4 100755
d9e4dd
--- a/setup.py
d9e4dd
+++ b/setup.py
d9e4dd
@@ -125,14 +125,6 @@ INITSYS_FILES = {
d9e4dd
     'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],
d9e4dd
     'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],
d9e4dd
     'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)],
d9e4dd
-    'systemd': [render_tmpl(f)
d9e4dd
-                for f in (glob('systemd/*.tmpl') +
d9e4dd
-                          glob('systemd/*.service') +
d9e4dd
-                          glob('systemd/*.target'))
d9e4dd
-                if (is_f(f) and not is_generator(f))],
d9e4dd
-    'systemd.generators': [
d9e4dd
-        render_tmpl(f, mode=0o755)
d9e4dd
-        for f in glob('systemd/*') if is_f(f) and is_generator(f)],
d9e4dd
     'upstart': [f for f in glob('upstart/*') if is_f(f)],
d9e4dd
 }
d9e4dd
 INITSYS_ROOTS = {
d9e4dd
@@ -142,9 +134,6 @@ INITSYS_ROOTS = {
d9e4dd
     'sysvinit_deb': 'etc/init.d',
d9e4dd
     'sysvinit_openrc': 'etc/init.d',
d9e4dd
     'sysvinit_suse': 'etc/init.d',
d9e4dd
-    'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),
d9e4dd
-    'systemd.generators': pkg_config_read('systemd',
d9e4dd
-                                          'systemdsystemgeneratordir'),
d9e4dd
     'upstart': 'etc/init/',
d9e4dd
 }
d9e4dd
 INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()])
d9e4dd
@@ -245,14 +234,11 @@ if not in_virtualenv():
d9e4dd
         INITSYS_ROOTS[k] = "/" + INITSYS_ROOTS[k]
d9e4dd
 
d9e4dd
 data_files = [
d9e4dd
-    (ETC + '/cloud', [render_tmpl("config/cloud.cfg.tmpl")]),
d9e4dd
+    (ETC + '/bash_completion.d', ['bash_completion/cloud-init']),
d9e4dd
     (ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
d9e4dd
     (ETC + '/cloud/templates', glob('templates/*')),
d9e4dd
-    (USR_LIB_EXEC + '/cloud-init', ['tools/ds-identify',
d9e4dd
-                                    'tools/uncloud-init',
d9e4dd
+    (USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
d9e4dd
                                     'tools/write-ssh-key-fingerprints']),
d9e4dd
-    (USR + '/share/bash-completion/completions',
d9e4dd
-     ['bash_completion/cloud-init']),
d9e4dd
     (USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]),
d9e4dd
     (USR + '/share/doc/cloud-init/examples',
d9e4dd
         [f for f in glob('doc/examples/*') if is_f(f)]),
d9e4dd
@@ -263,8 +249,7 @@ if not platform.system().endswith('BSD'):
d9e4dd
     data_files.extend([
d9e4dd
         (ETC + '/NetworkManager/dispatcher.d/',
d9e4dd
          ['tools/hook-network-manager']),
d9e4dd
-        (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),
d9e4dd
-        (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')])
d9e4dd
+        ('/usr/lib/udev/rules.d', [f for f in glob('udev/*.rules')])
d9e4dd
     ])
d9e4dd
 # Use a subclass for install that handles
d9e4dd
 # adding on the right init system configuration files
d9e4dd
@@ -286,8 +271,6 @@ setuptools.setup(
d9e4dd
     scripts=['tools/cloud-init-per'],
d9e4dd
     license='Dual-licensed under GPLv3 or Apache 2.0',
d9e4dd
     data_files=data_files,
d9e4dd
-    install_requires=requirements,
d9e4dd
-    cmdclass=cmdclass,
d9e4dd
     entry_points={
d9e4dd
         'console_scripts': [
d9e4dd
             '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
-- 
d9e4dd
2.27.0
d9e4dd