- put
<distribution-name>.user-data
to%USERPROFILE%\.cloud-init
- start wsl2:
wsl.exe -d <distribution-name> --cd ~
- exec
cloud-init.sh
cloud-init init --local
cloud-init init
cloud-init modules --mode=config
cloud-init modules --mode=final
- restart wsl2
Last active
November 22, 2024 15:03
-
-
Save junkor-1011/945f9cec10a8cfd8a81f01bf926486f3 to your computer and use it in GitHub Desktop.
WSL2 cloud-init example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
# EXAMPLE | |
timezone: Asia/Tokyo | |
locale: en_US.utf8 | |
users: | |
- name: wsl-user | |
groups: [adm, sudo, wheel] | |
sudo: | |
- ALL=(ALL) NOPASSWD:ALL | |
uid: 1000 | |
shell: /usr/bin/fish | |
package_update: true | |
package_upgrade: true | |
packages: | |
- tmux | |
- fish | |
- htop | |
- fzf | |
- ripgrep | |
write_files: | |
- path: /etc/wsl.conf | |
append: true | |
content: | | |
[boot] | |
systemd=true | |
[user] | |
default=wsl-user | |
runcmd: | |
- echo "cloud-init" >> /tmp/sample.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cloud-init init --local | |
cloud-init init | |
cloud-init modules --mode=config | |
cloud-init modules --mode=final |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment