1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
|
## template:jinja
# The top level settings are used as module
# and base configuration.
{% set is_bsd = variant in ["dragonfly", "freebsd", "netbsd", "openbsd"] %}
{% set is_rhel = variant in ["almalinux", "centos", "cloudlinux", "eurolinux",
"miraclelinux", "rhel", "rocky", "virtuozzo"] %}
{% set gecos = ({"amazon": "EC2 Default User", "azurelinux": "Azure Linux",
"centos": "Cloud User", "debian": "Debian",
"dragonfly": "DragonFly", "freebsd": "FreeBSD",
"mariner": "MarinerOS", "rhel": "Cloud User",
"netbsd": "NetBSD", "openbsd": "openBSD",
"openmandriva": "OpenMandriva admin", "photon": "PhotonOS",
"raspberry-pi-os": "Raspberry Pi OS",
"ubuntu": "Ubuntu", "unknown": "Ubuntu"}) %}
{% set groups = ({"alpine": "adm, wheel", "aosc": "wheel", "arch": "wheel, users",
"azurelinux": "wheel",
"debian": "adm, audio, cdrom, dialout, dip, floppy, netdev, plugdev, sudo, video",
"gentoo": "users, wheel", "mariner": "wheel",
"photon": "wheel",
"openmandriva": "wheel, users, systemd-journal",
"raspberry-pi-os": "adm, dialout, cdrom, audio, users, sudo, video, games, plugdev, input, gpio, spi, i2c, netdev, render, lpadmin",
"suse": "cdrom, users",
"ubuntu": "adm, cdrom, dip, lxd, sudo",
"unknown": "adm, cdrom, dip, lxd, sudo"}) %}
{% set shells = ({"alpine": "/bin/ash", "dragonfly": "/bin/sh",
"freebsd": "/bin/tcsh", "netbsd": "/bin/sh",
"openbsd": "/bin/ksh"}) %}
{% set usernames = ({"amazon": "ec2-user", "centos": "cloud-user",
"openmandriva": "omv", "raspberry-pi-os": "pi",
"rhel": "cloud-user",
"unknown": "ubuntu"}) %}
{% if is_bsd %}
syslog_fix_perms: root:wheel
{% elif variant == "suse" %}
syslog_fix_perms: root:root
{% endif %}
# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
{% if variant == "photon" %}
- name: root
lock_passwd: false
{% else %}
- default
{% endif %}
{% if variant == "photon" %}
# VMware guest customization.
disable_vmware_customization: true
manage_etc_hosts: false
{% endif -%}
# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the default $user
{% if variant in ["freebsd", "photon"] %}
disable_root: false
{% else %}
disable_root: true
{% endif %}
{%- if variant in ["alpine", "amazon", "fedora", "OpenCloudOS", "openeuler",
"openmandriva", "photon", "TencentOS"] or is_rhel %}
{% if is_rhel %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.after=cloud-init-network.service,_netdev', '0', '2']
{% else %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% endif %}
{% if variant == "amazon" %}
resize_rootfs: noblock
{% endif %}
{% if variant not in ["photon"] %}
ssh_pwauth: false
{% endif %}
{% endif %}
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: false
{% if variant == "debian" %}
apt:
# This prevents cloud-init from rewriting apt's sources.list file,
# which has been a source of surprise.
preserve_sources_list: true
{% endif -%}
# If you use datasource_list array, keep array items in a single line.
# If you use multi line array, ds-identify script won't read array items.
# Example datasource config
# datasource:
# Ec2:
# metadata_urls: [ 'blah.com' ]
# timeout: 5 # (defaults to 50 seconds)
# max_wait: 10 # (defaults to 120 seconds)
{% if variant == "amazon" %}
# Amazon Linux relies on ec2-net-utils for network configuration
network:
config: disabled
{% endif -%}
{% if is_rhel %}
# Default redhat settings:
ssh_deletekeys: true
ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']
syslog_fix_perms: ~
disable_vmware_customization: false
{% endif -%}
# The modules that run in the 'init' stage
cloud_init_modules:
{% if variant not in ["netbsd"] %}
- seed_random
{% endif %}
- bootcmd
- write_files
{% if variant not in ["netbsd", "openbsd"] %}
- growpart
- resizefs
{% endif %}
{% if not is_bsd %}
- disk_setup
- mounts
{% endif %}
- set_hostname
- update_hostname
- update_etc_hosts
{% if variant in ["alpine", "photon"] %}
- resolv_conf
{% endif %}
{% if not is_bsd or variant not in ["photon"] %}
- ca_certs
{% endif %}
- rsyslog
- users_groups
- ssh
- set_passwords
{% if variant == "raspberry-pi-os" %}
- raspberry_pi
{% endif %}
# The modules that run in the 'config' stage
cloud_config_modules:
{% if variant in ["ubuntu"] %}
- wireguard
{% endif %}
{% if variant in ["debian", "ubuntu", "unknown"] %}
- snap
{% endif %}
{% if variant == "ubuntu" %}
- ubuntu_autoinstall
{% endif %}
{% if variant not in ["photon"] %}
- ssh_import_id
{% if not is_rhel %}
- keyboard
{% endif %}
- locale
{% endif %}
{% if variant == "alpine" %}
- apk_configure
{% elif variant in ["debian", "ubuntu", "unknown"] %}
- grub_dpkg
- apt_pipelining
- apt_configure
{% if variant == "ubuntu" %}
- ubuntu_pro
{% endif %}
{% elif variant in ["azurelinux", "fedora", "mariner", "openeuler",
"openmandriva", "photon"] or is_rhel %}
{% if is_rhel %}
- rh_subscription
{% endif %}
{% if variant not in ["azurelinux", "mariner", "photon"] %}
- spacewalk
{% endif %}
- yum_add_repo
{% elif variant == "suse" %}
- zypper_add_repo
{% endif %}
- ntp
- timezone
{% if variant not in ["azurelinux"] %}
- disable_ec2_metadata
{% endif %}
- runcmd
{% if variant in ["debian", "ubuntu", "unknown"] %}
- byobu
{% endif %}
# The modules that run in the 'final' stage
cloud_final_modules:
- package_update_upgrade_install
{% if variant in ["debian", "ubuntu", "unknown"] %}
- fan
- landscape
- lxd
{% endif %}
{% if variant in ["ubuntu", "unknown"] %}
- ubuntu_drivers
{% endif %}
- write_files_deferred
{% if variant not in ["azurelinux"] %}
- puppet
- chef
{% endif %}
- ansible
{% if variant not in ["azurelinux"] %}
- mcollective
- salt_minion
{% if variant not in ["alpine"] %}
- reset_rmc
{% endif %}
{% endif %}
- scripts_vendor
- scripts_per_once
- scripts_per_boot
- scripts_per_instance
- scripts_user
- ssh_authkey_fingerprints
- keys_to_console
- install_hotplug
- phone_home
- final_message
- power_state_change
# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
{% if variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "debian", "fedora",
"freebsd", "gentoo", "mariner", "netbsd", "openbsd",
"OpenCloudOS", "openeuler", "openmandriva", "photon",
"raspberry-pi-os", "suse", "TencentOS", "ubuntu"] or is_rhel %}
distro: {{ variant }}
{% elif variant == "dragonfly" %}
distro: dragonflybsd
{% else %}
# Unknown/fallback distro.
distro: ubuntu
{% endif %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant in usernames %}
name: {{ usernames[variant] }}
{% else %}
name: {{ variant }}
{% endif %}
{% if variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "debian", "fedora",
"gentoo", "mariner", "OpenCloudOS", "openeuler",
"openmandriva", "photon", "raspberry-pi-os",
"suse", "TencentOS", "ubuntu", "unknown"]
or is_bsd or is_rhel %}
lock_passwd: True
{% endif %}
{% if variant in gecos %}
gecos: {{ gecos[variant] }}
{% else %}
gecos: {{ variant }} Cloud User
{% endif %}
{% if variant in groups %}
groups: [{{ groups[variant] }}]
{% elif is_bsd %}
groups: [wheel]
{% elif is_rhel %}
groups: [adm, systemd-journal]
{% else %}
groups: [wheel, adm, systemd-journal]
{% endif %}
{% if variant == "gentoo" %}
primary_group: users
no_user_group: true
{% endif %}
{% if variant in ["alpine", "freebsd", "openbsd"] %}
{% if variant in usernames %}
doas:
- permit nopass usernames[{{ variant }}]
{% else %}
doas:
- permit nopass {{ variant }}
{% endif %}
{% endif %}
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
{% if variant in shells %}
shell: {{ shells[variant] }}
{% else %}
shell: /bin/bash
{% endif %}
{% if variant == "alpine" %}
network:
renderers: ['eni']
{% elif variant == "debian" %}
network:
renderers: ['netplan', 'eni', 'networkd']
activators: ['netplan', 'eni', 'network-manager', 'networkd']
{% elif variant == "dragonfly" %}
network:
renderers: ['freebsd']
{% elif variant == "fedora" %}
network:
renderers: ['netplan', 'network-manager', 'networkd', 'sysconfig', 'eni']
{% elif variant in ["freebsd", "netbsd", "openbsd"] %}
network:
renderers: ['{{ variant }}']
{% elif variant in ["azurelinux", "mariner", "photon"] %}
network:
renderers: ['networkd']
{% elif variant == "openmandriva" %}
network:
renderers: ['network-manager', 'networkd']
{% elif variant == "raspberry-pi-os" %}
network:
renderers: ['netplan', 'network-manager']
activators: ['netplan', 'network-manager']
{% elif variant in ["ubuntu", "unknown"] %}
{# SRU_BLOCKER: do not ship network renderers on Xenial, Bionic or Eoan #}
network:
dhcp_client_priority: [dhcpcd, dhclient, udhcpc]
renderers: ['netplan', 'eni', 'sysconfig']
activators: ['netplan', 'eni', 'network-manager', 'networkd']
{% elif is_rhel %}
network:
renderers: ['eni', 'netplan', 'network-manager', 'sysconfig', 'networkd']
{% endif %}
{% if variant == "photon" %}
# If set to true, cloud-init will not use fallback network config.
# In Photon, we have default network settings, hence if network settings are
# not explicitly given in metadata, don't use fallback network config.
disable_fallback_netcfg: true
{% endif %}
{% if variant in ["debian", "ubuntu", "unknown"] %}
# Automatically discover the best ntp_client
ntp_client: auto
{% endif %}
{% if variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "debian", "fedora",
"gentoo", "mariner", "OpenCloudOS", "openeuler",
"openmandriva", "photon", "suse", "TencentOS", "ubuntu",
"unknown"]
or is_rhel %}
# 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/
{% elif is_bsd %}
paths:
run_dir: /var/run/cloud-init/
{% endif %}
{% if variant == "debian" %}
package_mirrors:
- arches: [default]
failsafe:
primary: https://deb.debian.org/debian
security: https://deb.debian.org/debian-security
{% elif variant == "raspberry-pi-os" %}
package_mirrors:
- arches: [arm64]
failsafe:
primary:
- https://deb.debian.org/debian
- http://archive.raspberrypi.com/debian/
security: https://deb.debian.org/debian-security
- arches: [armhf]
failsafe:
primary:
- http://raspbian.raspberrypi.com/raspbian/
- http://archive.raspberrypi.com/debian/
{% elif variant in ["ubuntu", "unknown"] %}
package_mirrors:
- arches: [i386, amd64]
failsafe:
primary: http://archive.ubuntu.com/ubuntu
security: http://security.ubuntu.com/ubuntu
search:
primary:
- http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/
- http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/
- http://%(region)s.clouds.archive.ubuntu.com/ubuntu/
security: []
- arches: [arm64, armel, armhf]
failsafe:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
search:
primary:
- http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/
- http://%(availability_zone)s.clouds.ports.ubuntu.com/ubuntu-ports/
- http://%(region)s.clouds.ports.ubuntu.com/ubuntu-ports/
security: []
- arches: [default]
failsafe:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
{% endif %}
{% if variant in ["debian", "raspberry-pi-os", "ubuntu", "unknown"] %}
ssh_svcname: ssh
{% elif variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "fedora",
"gentoo", "mariner", "OpenCloudOS", "openeuler",
"openmandriva", "photon", "suse", "TencentOS"]
or is_rhel %}
ssh_svcname: sshd
{% endif %}
|