sailesh1993 / rpms / cloud-init

Forked from rpms/cloud-init a year ago
Clone
ef3f20
From 0efc7b53fd849b1faea9fca1ecc85dfe384de035 Mon Sep 17 00:00:00 2001
ef3f20
From: Lars Kellogg-Stedman <lars@redhat.com>
ef3f20
Date: Thu, 1 Dec 2016 19:40:36 -0500
ef3f20
Subject: [PATCH] configuration changes for RHEL package
ef3f20
ef3f20
remove python dependencies from setup.py (because we handle these via
ef3f20
packages instead) and make any changes to default values to handle
ef3f20
RHEL environments.
ef3f20
ef3f20
install README and configfiles for rhel.
ef3f20
ef3f20
X-downstream-only: true
ef3f20
---
ef3f20
 cloudinit/config/cc_chef.py   |  6 ++--
ef3f20
 cloudinit/settings.py         |  7 +++--
ef3f20
 rhel/README.rhel              |  5 ++++
ef3f20
 rhel/cloud-init-tmpfiles.conf |  1 +
ef3f20
 rhel/cloud.cfg                | 66 +++++++++++++++++++++++++++++++++++++++++++
ef3f20
 setup.py                      |  4 +--
ef3f20
 6 files changed, 81 insertions(+), 8 deletions(-)
ef3f20
 create mode 100644 rhel/README.rhel
ef3f20
 create mode 100644 rhel/cloud-init-tmpfiles.conf
ef3f20
 create mode 100644 rhel/cloud.cfg
ef3f20
ef3f20
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
ef3f20
index f6564e5..38f01b7 100644
ef3f20
--- a/cloudinit/config/cc_chef.py
ef3f20
+++ b/cloudinit/config/cc_chef.py
ef3f20
@@ -33,7 +33,7 @@ file).
ef3f20
 
ef3f20
     chef:
ef3f20
        directories: (defaulting to /etc/chef, /var/log/chef, /var/lib/chef,
ef3f20
-                     /var/cache/chef, /var/backups/chef, /var/run/chef)
ef3f20
+                     /var/cache/chef, /var/backups/chef, /run/chef)
ef3f20
        validation_cert: (optional string to be written to file validation_key)
ef3f20
                         special value 'system' means set use existing file
ef3f20
        validation_key: (optional the path for validation_cert. default
ef3f20
@@ -85,7 +85,7 @@ CHEF_DIRS = tuple([
ef3f20
     '/var/lib/chef',
ef3f20
     '/var/cache/chef',
ef3f20
     '/var/backups/chef',
ef3f20
-    '/var/run/chef',
ef3f20
+    '/run/chef',
ef3f20
 ])
ef3f20
 REQUIRED_CHEF_DIRS = tuple([
ef3f20
     '/etc/chef',
ef3f20
@@ -109,7 +109,7 @@ CHEF_RB_TPL_DEFAULTS = {
ef3f20
     'json_attribs': CHEF_FB_PATH,
ef3f20
     'file_cache_path': "/var/cache/chef",
ef3f20
     'file_backup_path': "/var/backups/chef",
ef3f20
-    'pid_file': "/var/run/chef/client.pid",
ef3f20
+    'pid_file': "/run/chef/client.pid",
ef3f20
     'show_time': True,
ef3f20
 }
ef3f20
 CHEF_RB_TPL_BOOL_KEYS = frozenset(['show_time'])
ef3f20
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
ef3f20
index b1fdd31..6d31bb6 100644
ef3f20
--- a/cloudinit/settings.py
ef3f20
+++ b/cloudinit/settings.py
ef3f20
@@ -37,13 +37,16 @@ CFG_BUILTIN = {
ef3f20
     ],
ef3f20
     'def_log_file': '/var/log/cloud-init.log',
ef3f20
     'log_cfgs': [],
ef3f20
-    'syslog_fix_perms': ['syslog:adm', 'root:adm'],
ef3f20
+    'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
ef3f20
+    'ssh_deletekeys': False,
ef3f20
+    'ssh_genkeytypes': [],
ef3f20
+    'syslog_fix_perms': [],
ef3f20
     'system_info': {
ef3f20
         'paths': {
ef3f20
             'cloud_dir': '/var/lib/cloud',
ef3f20
             'templates_dir': '/etc/cloud/templates/',
ef3f20
         },
ef3f20
-        'distro': 'ubuntu',
ef3f20
+        'distro': 'rhel',
ef3f20
     },
ef3f20
     'vendor_data': {'enabled': True, 'prefix': []},
ef3f20
 }
ef3f20
diff --git a/rhel/README.rhel b/rhel/README.rhel
ef3f20
new file mode 100644
ef3f20
index 0000000..aa29630
ef3f20
--- /dev/null
ef3f20
+++ b/rhel/README.rhel
ef3f20
@@ -0,0 +1,5 @@
ef3f20
+The following cloud-init modules are currently unsupported on this OS:
ef3f20
+ - apt_update_upgrade ('apt_update', 'apt_upgrade', 'apt_mirror', 'apt_preserve_sources_list', 'apt_old_mirror', 'apt_sources', 'debconf_selections', 'packages' options)
ef3f20
+ - byobu ('byobu_by_default' option)
ef3f20
+ - chef
ef3f20
+ - grub_dpkg
ef3f20
diff --git a/rhel/cloud-init-tmpfiles.conf b/rhel/cloud-init-tmpfiles.conf
ef3f20
new file mode 100644
ef3f20
index 0000000..0c6d2a3
ef3f20
--- /dev/null
ef3f20
+++ b/rhel/cloud-init-tmpfiles.conf
ef3f20
@@ -0,0 +1 @@
ef3f20
+d /run/cloud-init 0700 root root - -
ef3f20
diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg
ef3f20
new file mode 100644
ef3f20
index 0000000..986f241
ef3f20
--- /dev/null
ef3f20
+++ b/rhel/cloud.cfg
ef3f20
@@ -0,0 +1,66 @@
ef3f20
+users:
ef3f20
+ - default
ef3f20
+
ef3f20
+disable_root: 1
ef3f20
+ssh_pwauth:   0
ef3f20
+
ef3f20
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
ef3f20
+resize_rootfs_tmp: /dev
ef3f20
+ssh_deletekeys:   0
ef3f20
+ssh_genkeytypes:  ~
ef3f20
+syslog_fix_perms: ~
ef3f20
+
ef3f20
+cloud_init_modules:
ef3f20
+ - migrator
ef3f20
+ - bootcmd
ef3f20
+ - write-files
ef3f20
+ - growpart
ef3f20
+ - resizefs
ef3f20
+ - set_hostname
ef3f20
+ - update_hostname
ef3f20
+ - update_etc_hosts
ef3f20
+ - rsyslog
ef3f20
+ - users-groups
ef3f20
+ - ssh
ef3f20
+
ef3f20
+cloud_config_modules:
ef3f20
+ - mounts
ef3f20
+ - locale
ef3f20
+ - set-passwords
ef3f20
+ - rh_subscription
ef3f20
+ - yum-add-repo
ef3f20
+ - package-update-upgrade-install
ef3f20
+ - timezone
ef3f20
+ - puppet
ef3f20
+ - chef
ef3f20
+ - salt-minion
ef3f20
+ - mcollective
ef3f20
+ - disable-ec2-metadata
ef3f20
+ - runcmd
ef3f20
+
ef3f20
+cloud_final_modules:
ef3f20
+ - rightscale_userdata
ef3f20
+ - scripts-per-once
ef3f20
+ - scripts-per-boot
ef3f20
+ - scripts-per-instance
ef3f20
+ - scripts-user
ef3f20
+ - ssh-authkey-fingerprints
ef3f20
+ - keys-to-console
ef3f20
+ - phone-home
ef3f20
+ - final-message
ef3f20
+
ef3f20
+system_info:
ef3f20
+  default_user:
ef3f20
+    name: cloud-user
ef3f20
+    lock_passwd: true
ef3f20
+    gecos: Cloud User
ef3f20
+    groups: [wheel, adm, systemd-journal]
ef3f20
+    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
ef3f20
+    shell: /bin/bash
ef3f20
+  distro: rhel
ef3f20
+  paths:
ef3f20
+    cloud_dir: /var/lib/cloud
ef3f20
+    templates_dir: /etc/cloud/templates
ef3f20
+  ssh_svcname: sshd
ef3f20
+
ef3f20
+# vim:syntax=yaml
ef3f20
diff --git a/setup.py b/setup.py
ef3f20
index 0403607..cc20c60 100755
ef3f20
--- a/setup.py
ef3f20
+++ b/setup.py
ef3f20
@@ -167,7 +167,6 @@ else:
ef3f20
         (ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
ef3f20
         (ETC + '/cloud/templates', glob('templates/*')),
ef3f20
         (ETC + '/NetworkManager/dispatcher.d/', ['tools/hook-network-manager']),
ef3f20
-        (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),
ef3f20
         (USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
ef3f20
                                         'tools/write-ssh-key-fingerprints']),
ef3f20
         (USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]),
ef3f20
@@ -175,7 +174,7 @@ else:
ef3f20
             [f for f in glob('doc/examples/*') if is_f(f)]),
ef3f20
         (USR + '/share/doc/cloud-init/examples/seed',
ef3f20
             [f for f in glob('doc/examples/seed/*') if is_f(f)]),
ef3f20
-        (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')]),
ef3f20
+        ('/usr/lib/udev/rules.d', [f for f in glob('udev/*.rules')]),
ef3f20
     ]
ef3f20
     # Use a subclass for install that handles
ef3f20
     # adding on the right init system configuration files
ef3f20
@@ -199,7 +198,6 @@ setuptools.setup(
ef3f20
     scripts=['tools/cloud-init-per'],
ef3f20
     license='Dual-licensed under GPLv3 or Apache 2.0',
ef3f20
     data_files=data_files,
ef3f20
-    install_requires=requirements,
ef3f20
     cmdclass=cmdclass,
ef3f20
     entry_points={
ef3f20
         'console_scripts': [