← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~rjschwei/cloud-init:tmplExpand into cloud-init:master

 

Robert Schweikert has proposed merging ~rjschwei/cloud-init:tmplExpand into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/331140

Integrate SUSE distros for template expansion of systemd and default config.
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~rjschwei/cloud-init:tmplExpand into cloud-init:master.
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 4c01f44..e1290aa 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 a537d65..e6b20ef 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.
@@ -186,4 +186,18 @@ system_info:
      groups: [wheel]
      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
      shell: /bin/tcsh
+{% elif variant in ["suse"] %}
+   # Default user name + that default users groups (if added/used)
+   default_user:
+     name: {{ variant }}
+     lock_passwd: True
+     gecos: {{ variant }} Cloud User
+     groups: [cdrom, users]
+     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
+     shell: /bin/bash
+   # Other config here will be given to the distro class and/or path classes
+   paths:
+      cloud_dir: /var/lib/cloud/
+      templates_dir: /etc/cloud/templates/
+   ssh_svcname: sshd
 {% endif %}
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
index ff9c644..870ccf1 100644
--- a/systemd/cloud-init-local.service.tmpl
+++ b/systemd/cloud-init-local.service.tmpl
@@ -13,6 +13,10 @@ Before=shutdown.target
 Before=sysinit.target
 Conflicts=shutdown.target
 {% endif %}
+{% if variant in ["suse"] %}
+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 2c71889..0dd45e5 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -13,6 +13,11 @@ After=networking.service
 {% if variant in ["centos", "fedora", "redhat"] %}
 After=network.service
 {% endif %}
+{% if variant in ["suse"] %}
+Requires=wicked.service
+After=wicked.service
+After=dbus.service
+{% endif %}
 Before=network-online.target
 Before=sshd-keygen.service
 Before=sshd.service
@@ -20,6 +25,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]

Follow ups