|
|
bb836b |
From 074cb9b011623849cfa95c1d7cc813bb28f03ff0 Mon Sep 17 00:00:00 2001
|
|
|
2b0ae0 |
From: Eduardo Otubo <otubo@redhat.com>
|
|
|
bb836b |
Date: Fri, 7 May 2021 13:36:03 +0200
|
|
|
18322d |
Subject: Add initial redhat setup
|
|
|
18322d |
|
|
|
bb836b |
Merged patches (21.1):
|
|
|
bb836b |
- 915d30ad Change gating file to correct rhel version
|
|
|
bb836b |
- 311f318d Removing net-tools dependency
|
|
|
bb836b |
- 74731806 Adding man pages to Red Hat spec file
|
|
|
bb836b |
- 758d333d Removing blocking test from yaml configuration file
|
|
|
bb836b |
- c7e7c59c Changing permission of cloud-init-generator to 755
|
|
|
bb836b |
- 8b85abbb Installing man pages in the correct place with correct permissions
|
|
|
bb836b |
- c6808d8d Fix unit failure of cloud-final.service if NetworkManager was not present.
|
|
|
bb836b |
- 11866ef6 Report full specific version with "cloud-init --version"
|
|
|
bb836b |
|
|
|
18322d |
Rebase notes (18.5):
|
|
|
18322d |
- added bash_completition file
|
|
|
18322d |
- added cloud-id file
|
|
|
18322d |
|
|
|
2b0ae0 |
Merged patches (20.3):
|
|
|
2b0ae0 |
- 01900d0 changing ds-identify patch from /usr/lib to /usr/libexec
|
|
|
2b0ae0 |
- 7f47ca3 Render the generator from template instead of cp
|
|
|
2b0ae0 |
|
|
|
8a7340 |
Merged patches (19.4):
|
|
|
8a7340 |
- 4ab5a61 Fix for network configuration not persisting after reboot
|
|
|
8a7340 |
- 84cf125 Removing cloud-user from wheel
|
|
|
8a7340 |
- 31290ab Adding gating tests for Azure, ESXi and AWS
|
|
|
8a7340 |
|
|
|
18322d |
Merged patches (18.5):
|
|
|
18322d |
- 2d6b469 add power-state-change module to cloud_final_modules
|
|
|
18322d |
- 764159f Adding systemd mount options to wait for cloud-init
|
|
|
18322d |
- da4d99e Adding disk_setup to rhel/cloud.cfg
|
|
|
18322d |
- f5c6832 Enable cloud-init by default on vmware
|
|
|
2b0ae0 |
|
|
|
2b0ae0 |
Conflicts:
|
|
|
2b0ae0 |
cloudinit/config/cc_chef.py:
|
|
|
2b0ae0 |
- Updated header documentation text
|
|
|
2b0ae0 |
- Replacing double quotes by simple quotes
|
|
|
2b0ae0 |
|
|
|
2b0ae0 |
setup.py:
|
|
|
2b0ae0 |
- Adding missing cmdclass info
|
|
|
2b0ae0 |
|
|
|
2b0ae0 |
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
18322d |
---
|
|
|
8a7340 |
.gitignore | 1 +
|
|
|
bb836b |
cloudinit/config/cc_chef.py | 67 +++-
|
|
|
18322d |
cloudinit/settings.py | 7 +-
|
|
|
18322d |
redhat/.gitignore | 1 +
|
|
|
bb836b |
redhat/Makefile | 71 ++++
|
|
|
bb836b |
redhat/Makefile.common | 37 ++
|
|
|
18322d |
redhat/cloud-init-tmpfiles.conf | 1 +
|
|
|
bb836b |
redhat/cloud-init.spec.template | 530 ++++++++++++++++++++++++++
|
|
|
bb836b |
redhat/gating.yaml | 8 +
|
|
|
18322d |
redhat/rpmbuild/BUILD/.gitignore | 3 +
|
|
|
18322d |
redhat/rpmbuild/RPMS/.gitignore | 3 +
|
|
|
18322d |
redhat/rpmbuild/SOURCES/.gitignore | 3 +
|
|
|
18322d |
redhat/rpmbuild/SPECS/.gitignore | 3 +
|
|
|
18322d |
redhat/rpmbuild/SRPMS/.gitignore | 3 +
|
|
|
2b0ae0 |
redhat/scripts/frh.py | 27 ++
|
|
|
bb836b |
redhat/scripts/git-backport-diff | 327 ++++++++++++++++
|
|
|
bb836b |
redhat/scripts/git-compile-check | 215 +++++++++++
|
|
|
bb836b |
redhat/scripts/process-patches.sh | 77 ++++
|
|
|
18322d |
redhat/scripts/tarball_checksum.sh | 3 +
|
|
|
18322d |
rhel/README.rhel | 5 +
|
|
|
18322d |
rhel/cloud-init-tmpfiles.conf | 1 +
|
|
|
bb836b |
rhel/cloud.cfg | 69 ++++
|
|
|
bb836b |
rhel/systemd/cloud-config.service | 18 +
|
|
|
18322d |
rhel/systemd/cloud-config.target | 11 +
|
|
|
bb836b |
rhel/systemd/cloud-final.service | 24 ++
|
|
|
2b0ae0 |
rhel/systemd/cloud-init-local.service | 31 ++
|
|
|
18322d |
rhel/systemd/cloud-init.service | 25 ++
|
|
|
8a7340 |
rhel/systemd/cloud-init.target | 7 +
|
|
|
2b0ae0 |
setup.py | 23 +-
|
|
|
2b0ae0 |
tools/read-version | 28 +-
|
|
|
bb836b |
30 files changed, 1579 insertions(+), 50 deletions(-)
|
|
|
18322d |
create mode 100644 redhat/.gitignore
|
|
|
18322d |
create mode 100644 redhat/Makefile
|
|
|
18322d |
create mode 100644 redhat/Makefile.common
|
|
|
18322d |
create mode 100644 redhat/cloud-init-tmpfiles.conf
|
|
|
18322d |
create mode 100644 redhat/cloud-init.spec.template
|
|
|
8a7340 |
create mode 100644 redhat/gating.yaml
|
|
|
18322d |
create mode 100644 redhat/rpmbuild/BUILD/.gitignore
|
|
|
18322d |
create mode 100644 redhat/rpmbuild/RPMS/.gitignore
|
|
|
18322d |
create mode 100644 redhat/rpmbuild/SOURCES/.gitignore
|
|
|
18322d |
create mode 100644 redhat/rpmbuild/SPECS/.gitignore
|
|
|
18322d |
create mode 100644 redhat/rpmbuild/SRPMS/.gitignore
|
|
|
18322d |
create mode 100755 redhat/scripts/frh.py
|
|
|
18322d |
create mode 100755 redhat/scripts/git-backport-diff
|
|
|
18322d |
create mode 100755 redhat/scripts/git-compile-check
|
|
|
18322d |
create mode 100755 redhat/scripts/process-patches.sh
|
|
|
18322d |
create mode 100755 redhat/scripts/tarball_checksum.sh
|
|
|
18322d |
create mode 100644 rhel/README.rhel
|
|
|
18322d |
create mode 100644 rhel/cloud-init-tmpfiles.conf
|
|
|
18322d |
create mode 100644 rhel/cloud.cfg
|
|
|
18322d |
create mode 100644 rhel/systemd/cloud-config.service
|
|
|
18322d |
create mode 100644 rhel/systemd/cloud-config.target
|
|
|
18322d |
create mode 100644 rhel/systemd/cloud-final.service
|
|
|
18322d |
create mode 100644 rhel/systemd/cloud-init-local.service
|
|
|
18322d |
create mode 100644 rhel/systemd/cloud-init.service
|
|
|
8a7340 |
create mode 100644 rhel/systemd/cloud-init.target
|
|
|
18322d |
|
|
|
18322d |
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
|
|
|
bb836b |
index aaf71366..97ef649a 100644
|
|
|
18322d |
--- a/cloudinit/config/cc_chef.py
|
|
|
18322d |
+++ b/cloudinit/config/cc_chef.py
|
|
|
2b0ae0 |
@@ -6,7 +6,70 @@
|
|
|
2b0ae0 |
#
|
|
|
2b0ae0 |
# This file is part of cloud-init. See LICENSE file for license information.
|
|
|
18322d |
|
|
|
2b0ae0 |
-"""Chef: module that configures, starts and installs chef."""
|
|
|
2b0ae0 |
+"""
|
|
|
2b0ae0 |
+Chef
|
|
|
2b0ae0 |
+----
|
|
|
2b0ae0 |
+**Summary:** module that configures, starts and installs chef.
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+This module enables chef to be installed (from packages or
|
|
|
2b0ae0 |
+from gems, or from omnibus). Before this occurs chef configurations are
|
|
|
2b0ae0 |
+written to disk (validation.pem, client.pem, firstboot.json, client.rb),
|
|
|
2b0ae0 |
+and needed chef folders/directories are created (/etc/chef and /var/log/chef
|
|
|
2b0ae0 |
+and so-on). Then once installing proceeds correctly if configured chef will
|
|
|
2b0ae0 |
+be started (in daemon mode or in non-daemon mode) and then once that has
|
|
|
2b0ae0 |
+finished (if ran in non-daemon mode this will be when chef finishes
|
|
|
2b0ae0 |
+converging, if ran in daemon mode then no further actions are possible since
|
|
|
2b0ae0 |
+chef will have forked into its own process) then a post run function can
|
|
|
2b0ae0 |
+run that can do finishing activities (such as removing the validation pem
|
|
|
2b0ae0 |
+file).
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+**Internal name:** ``cc_chef``
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+**Module frequency:** per always
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+**Supported distros:** all
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+**Config keys**::
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+ chef:
|
|
|
2b0ae0 |
+ directories: (defaulting to /etc/chef, /var/log/chef, /var/lib/chef,
|
|
|
18322d |
+ /var/cache/chef, /var/backups/chef, /run/chef)
|
|
|
2b0ae0 |
+ validation_cert: (optional string to be written to file validation_key)
|
|
|
2b0ae0 |
+ special value 'system' means set use existing file
|
|
|
2b0ae0 |
+ validation_key: (optional the path for validation_cert. default
|
|
|
2b0ae0 |
+ /etc/chef/validation.pem)
|
|
|
2b0ae0 |
+ firstboot_path: (path to write run_list and initial_attributes keys that
|
|
|
2b0ae0 |
+ should also be present in this configuration, defaults
|
|
|
2b0ae0 |
+ to /etc/chef/firstboot.json)
|
|
|
2b0ae0 |
+ exec: boolean to run or not run chef (defaults to false, unless
|
|
|
2b0ae0 |
+ a gem installed is requested
|
|
|
2b0ae0 |
+ where this will then default
|
|
|
2b0ae0 |
+ to true)
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+ chef.rb template keys (if falsey, then will be skipped and not
|
|
|
2b0ae0 |
+ written to /etc/chef/client.rb)
|
|
|
2b0ae0 |
+
|
|
|
2b0ae0 |
+ chef:
|
|
|
2b0ae0 |
+ client_key:
|
|
|
2b0ae0 |
+ encrypted_data_bag_secret:
|
|
|
2b0ae0 |
+ environment:
|
|
|
2b0ae0 |
+ file_backup_path:
|
|
|
2b0ae0 |
+ file_cache_path:
|
|
|
2b0ae0 |
+ json_attribs:
|
|
|
2b0ae0 |
+ log_level:
|
|
|
2b0ae0 |
+ log_location:
|
|
|
2b0ae0 |
+ node_name:
|
|
|
2b0ae0 |
+ omnibus_url:
|
|
|
2b0ae0 |
+ omnibus_url_retries:
|
|
|
2b0ae0 |
+ omnibus_version:
|
|
|
2b0ae0 |
+ pid_file:
|
|
|
2b0ae0 |
+ server_url:
|
|
|
2b0ae0 |
+ show_time:
|
|
|
2b0ae0 |
+ ssl_verify_mode:
|
|
|
2b0ae0 |
+ validation_cert:
|
|
|
2b0ae0 |
+ validation_key:
|
|
|
2b0ae0 |
+ validation_name:
|
|
|
2b0ae0 |
+"""
|
|
|
2b0ae0 |
|
|
|
2b0ae0 |
import itertools
|
|
|
2b0ae0 |
import json
|
|
|
2b0ae0 |
@@ -31,7 +94,7 @@ CHEF_DIRS = tuple([
|
|
|
18322d |
'/var/lib/chef',
|
|
|
18322d |
'/var/cache/chef',
|
|
|
18322d |
'/var/backups/chef',
|
|
|
18322d |
- '/var/run/chef',
|
|
|
18322d |
+ '/run/chef',
|
|
|
18322d |
])
|
|
|
18322d |
REQUIRED_CHEF_DIRS = tuple([
|
|
|
18322d |
'/etc/chef',
|
|
|
18322d |
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
|
|
|
bb836b |
index 91e1bfe7..e690c0fd 100644
|
|
|
18322d |
--- a/cloudinit/settings.py
|
|
|
18322d |
+++ b/cloudinit/settings.py
|
|
|
bb836b |
@@ -47,13 +47,16 @@ CFG_BUILTIN = {
|
|
|
18322d |
],
|
|
|
18322d |
'def_log_file': '/var/log/cloud-init.log',
|
|
|
18322d |
'log_cfgs': [],
|
|
|
18322d |
- 'syslog_fix_perms': ['syslog:adm', 'root:adm', 'root:wheel', 'root:root'],
|
|
|
18322d |
+ 'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
|
|
|
18322d |
+ 'ssh_deletekeys': False,
|
|
|
18322d |
+ 'ssh_genkeytypes': [],
|
|
|
18322d |
+ 'syslog_fix_perms': [],
|
|
|
18322d |
'system_info': {
|
|
|
18322d |
'paths': {
|
|
|
18322d |
'cloud_dir': '/var/lib/cloud',
|
|
|
18322d |
'templates_dir': '/etc/cloud/templates/',
|
|
|
18322d |
},
|
|
|
18322d |
- 'distro': 'ubuntu',
|
|
|
18322d |
+ 'distro': 'rhel',
|
|
|
18322d |
'network': {'renderers': None},
|
|
|
18322d |
},
|
|
|
18322d |
'vendor_data': {'enabled': True, 'prefix': []},
|
|
|
18322d |
diff --git a/rhel/README.rhel b/rhel/README.rhel
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..aa29630d
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/README.rhel
|
|
|
18322d |
@@ -0,0 +1,5 @@
|
|
|
18322d |
+The following cloud-init modules are currently unsupported on this OS:
|
|
|
18322d |
+ - apt_update_upgrade ('apt_update', 'apt_upgrade', 'apt_mirror', 'apt_preserve_sources_list', 'apt_old_mirror', 'apt_sources', 'debconf_selections', 'packages' options)
|
|
|
18322d |
+ - byobu ('byobu_by_default' option)
|
|
|
18322d |
+ - chef
|
|
|
18322d |
+ - grub_dpkg
|
|
|
18322d |
diff --git a/rhel/cloud-init-tmpfiles.conf b/rhel/cloud-init-tmpfiles.conf
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..0c6d2a3b
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/cloud-init-tmpfiles.conf
|
|
|
18322d |
@@ -0,0 +1 @@
|
|
|
18322d |
+d /run/cloud-init 0700 root root - -
|
|
|
18322d |
diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..82e8bf62
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/cloud.cfg
|
|
|
18322d |
@@ -0,0 +1,69 @@
|
|
|
18322d |
+users:
|
|
|
18322d |
+ - default
|
|
|
18322d |
+
|
|
|
18322d |
+disable_root: 1
|
|
|
18322d |
+ssh_pwauth: 0
|
|
|
18322d |
+
|
|
|
18322d |
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
|
|
|
18322d |
+resize_rootfs_tmp: /dev
|
|
|
18322d |
+ssh_deletekeys: 0
|
|
|
18322d |
+ssh_genkeytypes: ~
|
|
|
18322d |
+syslog_fix_perms: ~
|
|
|
18322d |
+disable_vmware_customization: false
|
|
|
18322d |
+
|
|
|
18322d |
+cloud_init_modules:
|
|
|
18322d |
+ - disk_setup
|
|
|
18322d |
+ - migrator
|
|
|
18322d |
+ - bootcmd
|
|
|
18322d |
+ - write-files
|
|
|
18322d |
+ - growpart
|
|
|
18322d |
+ - resizefs
|
|
|
18322d |
+ - set_hostname
|
|
|
18322d |
+ - update_hostname
|
|
|
18322d |
+ - update_etc_hosts
|
|
|
18322d |
+ - rsyslog
|
|
|
18322d |
+ - users-groups
|
|
|
18322d |
+ - ssh
|
|
|
18322d |
+
|
|
|
18322d |
+cloud_config_modules:
|
|
|
18322d |
+ - mounts
|
|
|
18322d |
+ - locale
|
|
|
18322d |
+ - set-passwords
|
|
|
18322d |
+ - rh_subscription
|
|
|
18322d |
+ - yum-add-repo
|
|
|
18322d |
+ - package-update-upgrade-install
|
|
|
18322d |
+ - timezone
|
|
|
18322d |
+ - puppet
|
|
|
18322d |
+ - chef
|
|
|
18322d |
+ - salt-minion
|
|
|
18322d |
+ - mcollective
|
|
|
18322d |
+ - disable-ec2-metadata
|
|
|
18322d |
+ - runcmd
|
|
|
18322d |
+
|
|
|
18322d |
+cloud_final_modules:
|
|
|
18322d |
+ - rightscale_userdata
|
|
|
18322d |
+ - scripts-per-once
|
|
|
18322d |
+ - scripts-per-boot
|
|
|
18322d |
+ - scripts-per-instance
|
|
|
18322d |
+ - scripts-user
|
|
|
18322d |
+ - ssh-authkey-fingerprints
|
|
|
18322d |
+ - keys-to-console
|
|
|
18322d |
+ - phone-home
|
|
|
18322d |
+ - final-message
|
|
|
18322d |
+ - power-state-change
|
|
|
18322d |
+
|
|
|
18322d |
+system_info:
|
|
|
18322d |
+ default_user:
|
|
|
18322d |
+ name: cloud-user
|
|
|
18322d |
+ lock_passwd: true
|
|
|
18322d |
+ gecos: Cloud User
|
|
|
8a7340 |
+ groups: [adm, systemd-journal]
|
|
|
18322d |
+ sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
|
|
18322d |
+ shell: /bin/bash
|
|
|
18322d |
+ distro: rhel
|
|
|
18322d |
+ paths:
|
|
|
18322d |
+ cloud_dir: /var/lib/cloud
|
|
|
18322d |
+ templates_dir: /etc/cloud/templates
|
|
|
18322d |
+ ssh_svcname: sshd
|
|
|
18322d |
+
|
|
|
18322d |
+# vim:syntax=yaml
|
|
|
18322d |
diff --git a/rhel/systemd/cloud-config.service b/rhel/systemd/cloud-config.service
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..f3dcd4be
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/systemd/cloud-config.service
|
|
|
18322d |
@@ -0,0 +1,18 @@
|
|
|
18322d |
+[Unit]
|
|
|
18322d |
+Description=Apply the settings specified in cloud-config
|
|
|
18322d |
+After=network-online.target cloud-config.target
|
|
|
18322d |
+Wants=network-online.target cloud-config.target
|
|
|
18322d |
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
|
|
18322d |
+ConditionKernelCommandLine=!cloud-init=disabled
|
|
|
18322d |
+
|
|
|
18322d |
+[Service]
|
|
|
18322d |
+Type=oneshot
|
|
|
18322d |
+ExecStart=/usr/bin/cloud-init modules --mode=config
|
|
|
18322d |
+RemainAfterExit=yes
|
|
|
18322d |
+TimeoutSec=0
|
|
|
18322d |
+
|
|
|
18322d |
+# Output needs to appear in instance console output
|
|
|
18322d |
+StandardOutput=journal+console
|
|
|
18322d |
+
|
|
|
18322d |
+[Install]
|
|
|
8a7340 |
+WantedBy=cloud-init.target
|
|
|
18322d |
diff --git a/rhel/systemd/cloud-config.target b/rhel/systemd/cloud-config.target
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..ae9b7d02
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/systemd/cloud-config.target
|
|
|
18322d |
@@ -0,0 +1,11 @@
|
|
|
18322d |
+# cloud-init normally emits a "cloud-config" upstart event to inform third
|
|
|
18322d |
+# parties that cloud-config is available, which does us no good when we're
|
|
|
18322d |
+# using systemd. cloud-config.target serves as this synchronization point
|
|
|
18322d |
+# instead. Services that would "start on cloud-config" with upstart can
|
|
|
18322d |
+# instead use "After=cloud-config.target" and "Wants=cloud-config.target"
|
|
|
18322d |
+# as appropriate.
|
|
|
18322d |
+
|
|
|
18322d |
+[Unit]
|
|
|
18322d |
+Description=Cloud-config availability
|
|
|
18322d |
+Wants=cloud-init-local.service cloud-init.service
|
|
|
18322d |
+After=cloud-init-local.service cloud-init.service
|
|
|
18322d |
diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..e281c0cf
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/systemd/cloud-final.service
|
|
|
bb836b |
@@ -0,0 +1,24 @@
|
|
|
18322d |
+[Unit]
|
|
|
18322d |
+Description=Execute cloud user/final scripts
|
|
|
18322d |
+After=network-online.target cloud-config.service rc-local.service
|
|
|
18322d |
+Wants=network-online.target cloud-config.service
|
|
|
18322d |
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
|
|
18322d |
+ConditionKernelCommandLine=!cloud-init=disabled
|
|
|
18322d |
+
|
|
|
18322d |
+[Service]
|
|
|
18322d |
+Type=oneshot
|
|
|
18322d |
+ExecStart=/usr/bin/cloud-init modules --mode=final
|
|
|
18322d |
+RemainAfterExit=yes
|
|
|
18322d |
+TimeoutSec=0
|
|
|
18322d |
+KillMode=process
|
|
|
bb836b |
+# Restart NetworkManager if it is present and running.
|
|
|
bb836b |
+ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
|
|
|
bb836b |
+ out=$(systemctl show --property=SubState $u) || exit; \
|
|
|
bb836b |
+ [ "$out" = "SubState=running" ] || exit 0; \
|
|
|
bb836b |
+ systemctl reload-or-try-restart $u'
|
|
|
18322d |
+
|
|
|
18322d |
+# Output needs to appear in instance console output
|
|
|
18322d |
+StandardOutput=journal+console
|
|
|
18322d |
+
|
|
|
18322d |
+[Install]
|
|
|
8a7340 |
+WantedBy=cloud-init.target
|
|
|
18322d |
diff --git a/rhel/systemd/cloud-init-local.service b/rhel/systemd/cloud-init-local.service
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..8f9f6c9f
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/systemd/cloud-init-local.service
|
|
|
18322d |
@@ -0,0 +1,31 @@
|
|
|
18322d |
+[Unit]
|
|
|
18322d |
+Description=Initial cloud-init job (pre-networking)
|
|
|
18322d |
+DefaultDependencies=no
|
|
|
18322d |
+Wants=network-pre.target
|
|
|
18322d |
+After=systemd-remount-fs.service
|
|
|
18322d |
+Requires=dbus.socket
|
|
|
18322d |
+After=dbus.socket
|
|
|
18322d |
+Before=NetworkManager.service network.service
|
|
|
18322d |
+Before=network-pre.target
|
|
|
18322d |
+Before=shutdown.target
|
|
|
18322d |
+Before=firewalld.target
|
|
|
18322d |
+Conflicts=shutdown.target
|
|
|
18322d |
+RequiresMountsFor=/var/lib/cloud
|
|
|
18322d |
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
|
|
18322d |
+ConditionKernelCommandLine=!cloud-init=disabled
|
|
|
18322d |
+
|
|
|
18322d |
+[Service]
|
|
|
18322d |
+Type=oneshot
|
|
|
18322d |
+ExecStartPre=/bin/mkdir -p /run/cloud-init
|
|
|
18322d |
+ExecStartPre=/sbin/restorecon /run/cloud-init
|
|
|
18322d |
+ExecStartPre=/usr/bin/touch /run/cloud-init/enabled
|
|
|
18322d |
+ExecStart=/usr/bin/cloud-init init --local
|
|
|
18322d |
+ExecStart=/bin/touch /run/cloud-init/network-config-ready
|
|
|
18322d |
+RemainAfterExit=yes
|
|
|
18322d |
+TimeoutSec=0
|
|
|
18322d |
+
|
|
|
18322d |
+# Output needs to appear in instance console output
|
|
|
18322d |
+StandardOutput=journal+console
|
|
|
18322d |
+
|
|
|
18322d |
+[Install]
|
|
|
8a7340 |
+WantedBy=cloud-init.target
|
|
|
18322d |
diff --git a/rhel/systemd/cloud-init.service b/rhel/systemd/cloud-init.service
|
|
|
18322d |
new file mode 100644
|
|
|
bb836b |
index 00000000..d0023a05
|
|
|
18322d |
--- /dev/null
|
|
|
18322d |
+++ b/rhel/systemd/cloud-init.service
|
|
|
18322d |
@@ -0,0 +1,25 @@
|
|
|
18322d |
+[Unit]
|
|
|
18322d |
+Description=Initial cloud-init job (metadata service crawler)
|
|
|
18322d |
+Wants=cloud-init-local.service
|
|
|
18322d |
+Wants=sshd-keygen.service
|
|
|
18322d |
+Wants=sshd.service
|
|
|
18322d |
+After=cloud-init-local.service
|
|
|
18322d |
+After=NetworkManager.service network.service
|
|
|
18322d |
+Before=network-online.target
|
|
|
18322d |
+Before=sshd-keygen.service
|
|
|
18322d |
+Before=sshd.service
|
|
|
18322d |
+Before=systemd-user-sessions.service
|
|
|
18322d |
+ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
|
|
18322d |
+ConditionKernelCommandLine=!cloud-init=disabled
|
|
|
18322d |
+
|
|
|
18322d |
+[Service]
|
|
|
18322d |
+Type=oneshot
|
|
|
18322d |
+ExecStart=/usr/bin/cloud-init init
|
|
|
18322d |
+RemainAfterExit=yes
|
|
|
18322d |
+TimeoutSec=0
|
|
|
18322d |
+
|
|
|
18322d |
+# Output needs to appear in instance console output
|
|
|
18322d |
+StandardOutput=journal+console
|
|
|
18322d |
+
|
|
|
18322d |
+[Install]
|
|
|
8a7340 |
+WantedBy=cloud-init.target
|
|
|
8a7340 |
diff --git a/rhel/systemd/cloud-init.target b/rhel/systemd/cloud-init.target
|
|
|
8a7340 |
new file mode 100644
|
|
|
bb836b |
index 00000000..083c3b6f
|
|
|
8a7340 |
--- /dev/null
|
|
|
8a7340 |
+++ b/rhel/systemd/cloud-init.target
|
|
|
8a7340 |
@@ -0,0 +1,7 @@
|
|
|
8a7340 |
+# cloud-init target is enabled by cloud-init-generator
|
|
|
8a7340 |
+# To disable it you can either:
|
|
|
8a7340 |
+# a.) boot with kernel cmdline of 'cloud-init=disabled'
|
|
|
8a7340 |
+# b.) touch a file /etc/cloud/cloud-init.disabled
|
|
|
8a7340 |
+[Unit]
|
|
|
8a7340 |
+Description=Cloud-init target
|
|
|
8a7340 |
+After=multi-user.target
|
|
|
18322d |
diff --git a/setup.py b/setup.py
|
|
|
bb836b |
index cbacf48e..d5cd01a4 100755
|
|
|
18322d |
--- a/setup.py
|
|
|
18322d |
+++ b/setup.py
|
|
|
2b0ae0 |
@@ -125,14 +125,6 @@ INITSYS_FILES = {
|
|
|
18322d |
'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],
|
|
|
18322d |
'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],
|
|
|
18322d |
'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)],
|
|
|
18322d |
- 'systemd': [render_tmpl(f)
|
|
|
18322d |
- for f in (glob('systemd/*.tmpl') +
|
|
|
18322d |
- glob('systemd/*.service') +
|
|
|
8a7340 |
- glob('systemd/*.target'))
|
|
|
8a7340 |
- if (is_f(f) and not is_generator(f))],
|
|
|
8a7340 |
- 'systemd.generators': [
|
|
|
8a7340 |
- render_tmpl(f, mode=0o755)
|
|
|
8a7340 |
- for f in glob('systemd/*') if is_f(f) and is_generator(f)],
|
|
|
18322d |
'upstart': [f for f in glob('upstart/*') if is_f(f)],
|
|
|
18322d |
}
|
|
|
18322d |
INITSYS_ROOTS = {
|
|
|
2b0ae0 |
@@ -142,9 +134,6 @@ INITSYS_ROOTS = {
|
|
|
18322d |
'sysvinit_deb': 'etc/init.d',
|
|
|
18322d |
'sysvinit_openrc': 'etc/init.d',
|
|
|
18322d |
'sysvinit_suse': 'etc/init.d',
|
|
|
18322d |
- 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),
|
|
|
18322d |
- 'systemd.generators': pkg_config_read('systemd',
|
|
|
18322d |
- 'systemdsystemgeneratordir'),
|
|
|
18322d |
'upstart': 'etc/init/',
|
|
|
18322d |
}
|
|
|
18322d |
INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()])
|
|
|
2b0ae0 |
@@ -245,14 +234,11 @@ if not in_virtualenv():
|
|
|
8a7340 |
INITSYS_ROOTS[k] = "/" + INITSYS_ROOTS[k]
|
|
|
18322d |
|
|
|
18322d |
data_files = [
|
|
|
18322d |
- (ETC + '/cloud', [render_tmpl("config/cloud.cfg.tmpl")]),
|
|
|
8a7340 |
+ (ETC + '/bash_completion.d', ['bash_completion/cloud-init']),
|
|
|
18322d |
(ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
|
|
|
18322d |
(ETC + '/cloud/templates', glob('templates/*')),
|
|
|
18322d |
- (USR_LIB_EXEC + '/cloud-init', ['tools/ds-identify',
|
|
|
18322d |
- 'tools/uncloud-init',
|
|
|
18322d |
+ (USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
|
|
|
18322d |
'tools/write-ssh-key-fingerprints']),
|
|
|
8a7340 |
- (USR + '/share/bash-completion/completions',
|
|
|
8a7340 |
- ['bash_completion/cloud-init']),
|
|
|
18322d |
(USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]),
|
|
|
18322d |
(USR + '/share/doc/cloud-init/examples',
|
|
|
8a7340 |
[f for f in glob('doc/examples/*') if is_f(f)]),
|
|
|
2b0ae0 |
@@ -263,8 +249,7 @@ if not platform.system().endswith('BSD'):
|
|
|
18322d |
data_files.extend([
|
|
|
18322d |
(ETC + '/NetworkManager/dispatcher.d/',
|
|
|
18322d |
['tools/hook-network-manager']),
|
|
|
18322d |
- (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),
|
|
|
18322d |
- (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')])
|
|
|
18322d |
+ ('/usr/lib/udev/rules.d', [f for f in glob('udev/*.rules')])
|
|
|
18322d |
])
|
|
|
2b0ae0 |
# Use a subclass for install that handles
|
|
|
2b0ae0 |
# adding on the right init system configuration files
|
|
|
2b0ae0 |
@@ -286,8 +271,6 @@ setuptools.setup(
|
|
|
18322d |
scripts=['tools/cloud-init-per'],
|
|
|
18322d |
license='Dual-licensed under GPLv3 or Apache 2.0',
|
|
|
18322d |
data_files=data_files,
|
|
|
18322d |
- install_requires=requirements,
|
|
|
18322d |
- cmdclass=cmdclass,
|
|
|
18322d |
entry_points={
|
|
|
18322d |
'console_scripts': [
|
|
|
18322d |
'cloud-init = cloudinit.cmd.main:main',
|
|
|
18322d |
diff --git a/tools/read-version b/tools/read-version
|
|
|
bb836b |
index 02c90643..79755f78 100755
|
|
|
18322d |
--- a/tools/read-version
|
|
|
18322d |
+++ b/tools/read-version
|
|
|
2b0ae0 |
@@ -71,32 +71,8 @@ version_long = None
|
|
|
2b0ae0 |
is_release_branch_ci = (
|
|
|
2b0ae0 |
os.environ.get("TRAVIS_PULL_REQUEST_BRANCH", "").startswith("upstream/")
|
|
|
2b0ae0 |
)
|
|
|
2b0ae0 |
-if is_gitdir(_tdir) and which("git") and not is_release_branch_ci:
|
|
|
18322d |
- flags = []
|
|
|
18322d |
- if use_tags:
|
|
|
18322d |
- flags = ['--tags']
|
|
|
18322d |
- cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
|
|
|
18322d |
-
|
|
|
8a7340 |
- try:
|
|
|
8a7340 |
- version = tiny_p(cmd).strip()
|
|
|
8a7340 |
- except RuntimeError:
|
|
|
8a7340 |
- version = None
|
|
|
18322d |
-
|
|
|
8a7340 |
- if version is None or not version.startswith(src_version):
|
|
|
18322d |
- sys.stderr.write("git describe version (%s) differs from "
|
|
|
18322d |
- "cloudinit.version (%s)\n" % (version, src_version))
|
|
|
18322d |
- sys.stderr.write(
|
|
|
18322d |
- "Please get the latest upstream tags.\n"
|
|
|
18322d |
- "As an example, this can be done with the following:\n"
|
|
|
18322d |
- "$ git remote add upstream https://git.launchpad.net/cloud-init\n"
|
|
|
18322d |
- "$ git fetch upstream --tags\n"
|
|
|
18322d |
- )
|
|
|
18322d |
- sys.exit(1)
|
|
|
18322d |
-
|
|
|
18322d |
- version_long = tiny_p(cmd + ["--long"]).strip()
|
|
|
18322d |
-else:
|
|
|
18322d |
- version = src_version
|
|
|
18322d |
- version_long = None
|
|
|
18322d |
+version = src_version
|
|
|
18322d |
+version_long = None
|
|
|
18322d |
|
|
|
18322d |
# version is X.Y.Z[+xxx.gHASH]
|
|
|
18322d |
# version_long is None or X.Y.Z-xxx-gHASH
|
|
|
18322d |
--
|
|
|
bb836b |
2.27.0
|
|
|
18322d |
|