blob: 870b29da9ae0ee53cc9c199508cefa90cc8dd8eb [file] [log] [blame]
From 823454f1ea140ec47f5f9c5c3c5ad62eb458eb8a Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Wed, 24 Oct 2018 10:52:46 +0200
Subject: [PATCH 2/5] Add support for gentoo in cloud.cfg and templates
---
config/cloud.cfg.tmpl | 8 ++++++--
templates/hosts.gentoo.tmpl | 23 +++++++++++++++++++++++
tools/render-cloudcfg | 2 +-
3 files changed, 30 insertions(+), 3 deletions(-)
create mode 100644 templates/hosts.gentoo.tmpl
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index b66bbe60..3ee03343 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -176,7 +176,7 @@ cloud_final_modules:
system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
- "eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "openEuler",
+ "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "openbsd", "openEuler",
"photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
@@ -231,7 +231,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "eurolinux",
- "fedora", "openEuler", "rhel", "rocky", "suse", "virtuozzo"] %}
+ "fedora", "openEuler", "gentoo", "rhel", "rocky", "suse", "virtuozzo"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
@@ -245,6 +245,10 @@ system_info:
{% endif %}
{% if variant == "suse" %}
groups: [cdrom, users]
+{% elif variant == "gentoo" %}
+ groups: [users, wheel]
+ primary_group: users
+ no_user_group: true
{% elif variant == "alpine" %}
groups: [adm, sudo]
{% elif variant == "arch" %}
diff --git a/templates/hosts.gentoo.tmpl b/templates/hosts.gentoo.tmpl
new file mode 100644
index 00000000..0c2bd1e9
--- /dev/null
+++ b/templates/hosts.gentoo.tmpl
@@ -0,0 +1,23 @@
+## template:jinja
+{#
+This file /etc/cloud/templates/hosts.gentoo.tmpl is only utilized
+if enabled in cloud-config. Specifically, in order to enable it
+you need to add the following to config:
+ manage_etc_hosts: True
+-#}
+# Your system has configured 'manage_etc_hosts' as True.
+# As a result, if you wish for changes to this file to persist
+# then you will need to either
+# a.) make changes to the master file in /etc/cloud/templates/hosts.gentoo.tmpl
+# b.) change or remove the value of 'manage_etc_hosts' in
+# /etc/cloud/cloud.cfg or cloud-config from user-data
+#
+# The following lines are desirable for IPv4 capable hosts
+127.0.0.1 {{fqdn}} {{hostname}}
+127.0.0.1 localhost.localdomain localhost
+127.0.0.1 localhost4.localdomain4 localhost4
+
+# The following lines are desirable for IPv6 capable hosts
+::1 {{fqdn}} {{hostname}}
+::1 localhost.localdomain localhost
+::1 localhost6.localdomain6 localhost6
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index 186d61b7..4ee3c00f 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -5,7 +5,7 @@ import os
import sys
VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
- "eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "openEuler", "photon",
+ "eurolinux", "fedora", "gentoo", "freebsd", "netbsd", "openbsd", "openEuler", "photon",
"rhel", "suse","rocky", "ubuntu", "unknown", "virtuozzo"]
--
2.34.1.575.g55b058a8bb-goog