Loading deploy/pyinfra/tasks/container_runtime/containerd.py +22 −0 Original line number Diff line number Diff line Loading @@ -40,9 +40,31 @@ files.replace( text=r'sandbox_image = "registry.k8s.io/pause:3.8', replace='sandbox_image = "registry.k8s.io/pause:3.10', _sudo=True ) # Enable certs.d config_path files.replace( name="Enable certs.d config_path for registry mirrors", path=containerd_config_path, text=r'config_path = ""', replace='config_path = "/etc/containerd/certs.d"', _sudo=True ) files.directory( name="Create containerd certs.d directory for registry.k8s.io", path="/etc/containerd/certs.d/registry.k8s.io", _sudo=True, ) files.template( name="Configure explicit IPv4 mirror for registry.k8s.io", src="templates/registry.k8s.io.hosts.toml.j2", dest="/etc/containerd/certs.d/registry.k8s.io/hosts.toml", _sudo=True, ) # Restart containerd systemd.service( name="Restart containerd", Loading deploy/pyinfra/tasks/system/kernel.py +0 −23 Original line number Diff line number Diff line Loading @@ -68,26 +68,3 @@ systemd.daemon_reload( name="Reload systemd", _sudo=True ) # Disable IPv6 at the kernel level via GRUB. # files.replace uses sed (not Python regex), so the pattern must be BRE/ERE: # no lookaheads. Skip when the file is missing or already has ipv6.disable=1. grub_cmdline = host.get_fact( Command, "grep -E '^GRUB_CMDLINE_LINUX=' /etc/default/grub 2>/dev/null || true", ) if grub_cmdline and "ipv6.disable=1" not in grub_cmdline: files.replace( name="Disable IPv6 in GRUB", path="/etc/default/grub", text=r'^GRUB_CMDLINE_LINUX="(.*)"$', replace=r'GRUB_CMDLINE_LINUX="\1 ipv6.disable=1"', extended_regex=True, _sudo=True, ) server.shell( name="Update GRUB", commands=["update-grub"], _sudo=True, ) deploy/pyinfra/templates/registry.k8s.io.hosts.toml.j2 0 → 100644 +5 −0 Original line number Diff line number Diff line server = "https://registry.k8s.io" [host."http://34.96.108.209"] capabilities = ["pull", "resolve"] skip_verify = true Loading
deploy/pyinfra/tasks/container_runtime/containerd.py +22 −0 Original line number Diff line number Diff line Loading @@ -40,9 +40,31 @@ files.replace( text=r'sandbox_image = "registry.k8s.io/pause:3.8', replace='sandbox_image = "registry.k8s.io/pause:3.10', _sudo=True ) # Enable certs.d config_path files.replace( name="Enable certs.d config_path for registry mirrors", path=containerd_config_path, text=r'config_path = ""', replace='config_path = "/etc/containerd/certs.d"', _sudo=True ) files.directory( name="Create containerd certs.d directory for registry.k8s.io", path="/etc/containerd/certs.d/registry.k8s.io", _sudo=True, ) files.template( name="Configure explicit IPv4 mirror for registry.k8s.io", src="templates/registry.k8s.io.hosts.toml.j2", dest="/etc/containerd/certs.d/registry.k8s.io/hosts.toml", _sudo=True, ) # Restart containerd systemd.service( name="Restart containerd", Loading
deploy/pyinfra/tasks/system/kernel.py +0 −23 Original line number Diff line number Diff line Loading @@ -68,26 +68,3 @@ systemd.daemon_reload( name="Reload systemd", _sudo=True ) # Disable IPv6 at the kernel level via GRUB. # files.replace uses sed (not Python regex), so the pattern must be BRE/ERE: # no lookaheads. Skip when the file is missing or already has ipv6.disable=1. grub_cmdline = host.get_fact( Command, "grep -E '^GRUB_CMDLINE_LINUX=' /etc/default/grub 2>/dev/null || true", ) if grub_cmdline and "ipv6.disable=1" not in grub_cmdline: files.replace( name="Disable IPv6 in GRUB", path="/etc/default/grub", text=r'^GRUB_CMDLINE_LINUX="(.*)"$', replace=r'GRUB_CMDLINE_LINUX="\1 ipv6.disable=1"', extended_regex=True, _sudo=True, ) server.shell( name="Update GRUB", commands=["update-grub"], _sudo=True, )
deploy/pyinfra/templates/registry.k8s.io.hosts.toml.j2 0 → 100644 +5 −0 Original line number Diff line number Diff line server = "https://registry.k8s.io" [host."http://34.96.108.209"] capabilities = ["pull", "resolve"] skip_verify = true