You are viewing documentation for the Kairos release v3.2.4. For the latest release, click here.

Configuring wifi via cloud-config

This section describe examples on how to deploy Kairos with WiFi

This example is valid with Alpine.

#cloud-config

hostname: metal-{{ trunc 4 .MachineID }}
users:
  - name: kairos
    # Change to your pass here
    passwd: kairos
    ssh_authorized_keys:
    # Replace with your github user and un-comment the line below:
    # - github:mudler

stages:
  initramfs:
    - name: Setup wireless
      files:
        # See https://man.archlinux.org/man/connman-service.config.5
        - path: /var/lib/connman/home_wifi.config
          permissions: 0600
          content: |
            [service_home_wifi]
            Type = wifi
            Name = your_ssid
            Passphrase = your_wifi_password
            IPv4 = dhcp
  boot:
    - name: Enable wireless
      commands:
        - connmanctl enable wifi

This example is valid with openSUSE on a Raspberry Pi.

#cloud-config

hostname: metal-{{ trunc 4 .MachineID }}
users:
  - name: kairos
    # Change to your pass here
    passwd: kairos
    ssh_authorized_keys:
    # Replace with your github user and un-comment the line below:
    # - github:mudler

stages:
  initramfs:
    - name: "Setup wireless"
      files:
      - path: /etc/wpa_supplicant/wpa_supplicant.conf
        content: |
          # This file should be generated using wpa_passphrase
          ctrl_interface=/var/run/wpa_supplicant
          ctrl_interface_group=admin
          network={
                  ssid="$SSID_GOES_HERE"
                  psk="$PSK_GOES_HERE"
          }
        permissions: 0600
        owner: 0
        group: 0
      - path: /etc/systemd/network/20-dhcp-wlan0.network
        content: |
          [Match]
          Name=wlan0
          [Network]
          DHCP=yes
          [DHCP]
          ClientIdentifier=mac
        permissions: 0644
        owner: 0
        group: 0
  
  boot:
    - name: "Enabling wireless"
      commands:
        - |
          systemctl enable wpa_supplicant@wlan0
          systemctl disable wpa_supplicant
          systemctl stop wpa_supplicant || :
          systemctl start wpa_supplicant@wlan0 || :
Last modified September 23, 2024: Update WiFi docs (#258) (5aa0cba)