summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/util.py2
-rw-r--r--config/cloud.cfg.tmpl8
-rw-r--r--systemd/cloud-init-local.service.tmpl6
-rw-r--r--systemd/cloud-init.service.tmpl10
-rwxr-xr-xtools/render-cloudcfg5
5 files changed, 27 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 4c01f449..e1290aa8 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -598,6 +598,8 @@ def system_info():
var = 'ubuntu'
elif linux_dist == 'redhat':
var = 'rhel'
+ elif linux_dist == 'suse':
+ var = 'suse'
else:
var = 'linux'
elif system in ('windows', 'darwin', "freebsd"):
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index a537d65a..50e3bd86 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -127,7 +127,7 @@ cloud_final_modules:
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
-{% if variant in ["centos", "debian", "fedora", "rhel", "ubuntu", "freebsd"] %}
+{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
@@ -163,13 +163,17 @@ system_info:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
-{% elif variant in ["centos", "rhel", "fedora"] %}
+{% elif variant in ["centos", "rhel", "fedora", "suse"] %}
# Default user name + that default users groups (if added/used)
default_user:
name: {{ variant }}
lock_passwd: True
gecos: {{ variant }} Cloud User
+{% if variant == "suse" %}
+ groups: [cdrom, users]
+{% else %}
groups: [wheel, adm, systemd-journal]
+{% endif %}
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
# Other config here will be given to the distro class and/or path classes
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
index ff9c644d..bf6b2961 100644
--- a/systemd/cloud-init-local.service.tmpl
+++ b/systemd/cloud-init-local.service.tmpl
@@ -13,6 +13,12 @@ Before=shutdown.target
Before=sysinit.target
Conflicts=shutdown.target
{% endif %}
+{% if variant in ["suse"] %}
+# Other distros use Before=sysinit.target. There is not a clearly identified
+# reason for usage of basic.target instead.
+Before=basic.target
+Conflicts=shutdown.target
+{% endif %}
RequiresMountsFor=/var/lib/cloud
[Service]
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index 2c71889d..b92e8abc 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -13,6 +13,13 @@ After=networking.service
{% if variant in ["centos", "fedora", "redhat"] %}
After=network.service
{% endif %}
+{% if variant in ["suse"] %}
+Requires=wicked.service
+After=wicked.service
+# setting hostname via hostnamectl depends on dbus, which otherwise
+# would not be guaranteed at this point.
+After=dbus.service
+{% endif %}
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
@@ -20,6 +27,9 @@ Before=sshd.service
Before=sysinit.target
Conflicts=shutdown.target
{% endif %}
+{% if variant in ["suse"] %}
+Conflicts=shutdown.target
+{% endif %}
Before=systemd-user-sessions.service
[Service]
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index e624541a..8b7cb875 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -4,6 +4,8 @@ import argparse
import os
import sys
+VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"]
+
if "avoid-pep8-E402-import-not-top-of-file":
_tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, _tdir)
@@ -14,11 +16,10 @@ if "avoid-pep8-E402-import-not-top-of-file":
def main():
parser = argparse.ArgumentParser()
- variants = ["bsd", "centos", "fedora", "rhel", "ubuntu", "unknown"]
platform = util.system_info()
parser.add_argument(
"--variant", default=platform['variant'], action="store",
- help="define the variant.", choices=variants)
+ help="define the variant.", choices=VARIANTS)
parser.add_argument(
"template", nargs="?", action="store",
default='./config/cloud.cfg.tmpl',