Edit

Purpose: For operators, shows how to override default installation directories when the standard paths conflict with organizational policies or disk layout.

Task summary

Both roles use default paths on the C:\ drive. Override them when you need binaries on a different volume or must follow a specific directory convention.

Prerequisites

  • The target drive/directory must exist and be writable by the Ansible user

  • Completed the ../tutorial/getting-started.md[Getting Started tutorial] or have the collection installed

Steps

  1. Define the path overrides in your playbook:

---
- name: Setup Windows Worker with custom paths
  hosts: windows_workers
  vars:
    # win-containerd paths
    containerd_path: "D:\\containerd"
    cni_bin_path: "D:\\cni\\bin"
    cni_config_path: "D:\\cni\\config"

    # win-kubeadm paths
    kubernetes_path: "D:\\kubernetes"
    kubelet_log_path: "D:\\logs\\kubelet"
    nssm_install_directory: "D:\\tools\\nssm"

    # Required versions
    containerd_version: "1.7.13"
    crictl_version: "1.29.0"
    kube_version: "1.29.0"
    k8s_internal_ip: "10.0.0.10"
  roles:
    - opencenter-cloud.opencenter_windows_workers.win-containerd
    - opencenter-cloud.opencenter_windows_workers.win-kubeadm
  1. Run the playbook:

ansible-playbook -i inventory.ini windows-workers.yml

The roles create the directories if they don’t exist and add them to the system PATH.

Verification

Check that binaries are in the expected locations:

Get-Command containerd.exe | Select-Object Source
Get-Command kubelet.exe | Select-Object Source
Get-Command crictl.exe | Select-Object Source

Each should point to your custom paths.

Troubleshooting

If kubelet or containerd commands aren’t found after installation, the system PATH update may require a reboot or new PowerShell session to take effect. The roles add paths via win_path, which modifies the registry but doesn’t affect existing sessions.