Is it possible to cloud-init on Windows?
PS C:\Users\me\Documents> multipass launch -n test -v -cloud-init .\cloud.yaml
launch failed: Unable to find an image matching “.\cloud.yaml”
Is it possible to cloud-init on Windows?
PS C:\Users\me\Documents> multipass launch -n test -v -cloud-init .\cloud.yaml
launch failed: Unable to find an image matching “.\cloud.yaml”
Hi @sundmoon!
Sure, it’s definitely possible. It looks like your command line is slightly wrong.
You have -cloud-init
(single dash) whereas it should be --cloud-init
(double dash).
Thanks and good luck!
@townsend
Thank you, it works
Could you provide any examples/shortcuts for making custom init.yaml ?
Being a windows guy,
I’d like to automate installing docker, powershell and customizing sshd_config:
Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile
Sure, all of the documentation can be found at https://cloudinit.readthedocs.io/en/latest/index.html.
@townsend
But at the very first look I see things irrelevant to multipass/Windows
for example I can’t fing logs
https://cloudinit.readthedocs.io/en/latest/topics/faq.html#faq
I would be nice to have some more focused howto’s provided
And what about local windows vhdx images?
multipass launch -n testwin image file:d:\win1909.vhdx
doesn’t work for me
Too many arguments supplied
Hi @sundmoon, Multipass can only run Linux guests, so even if you used the correct syntax (image
is extraneous), it wouldn’t work.
Also, launching local images like this is not currently supported on Windows and Mac.
Hello
This is my very first attempt to write a working yaml
All works for me but I also need to inject a line into sshd_config
Please help me to refine it in any linux/ubuntu way
#cloud-config
#write_files:
# - path: /etc/ssh/sshd_config
Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile
runcmd:
# netplan --debug apply
- apt-get -y update
- add-apt-repository universe
- apt-get -y clean
- apt-get -y autoremove --purge
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages:
- docker.io
snap:
commands:
00: snap install powershell --classic
power_state:
delay: now
mode: reboot
message: Rebooting the OS
condition: if [ -e /var/run/reboot-required ]; then exit 0; else exit 1; fi
Sorry for the bad formatting: I am also new to Discourse
Hi @sundmoon2, you just need to add a cat "Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile" >> /etc/ssh/sshd_config
to the commands
list.
Also I think package_reboot_if_required
should be enough if you’re not creating /var/run/reboot-required
yourself.
@saviq
Seems it is not working
ubuntu@test:~$ sudo su -
root@test:~# cat "Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile" >> /etc/ssh/sshd_config
cat: 'Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile': No such file or directory
root@test:~# ls /snap/bin/pwsh
/snap/bin/pwsh
Sorry @sundmoon, brain fart, this should’ve been echo
, not cat
@saviq
That’s why there are declarative provisioners
What is the advantage of multipass?
@saviq
That’s my final version
Reboot is required, or at least sshd restart
runcmd:
- apt-get -y update
- add-apt-repository universe
- apt-get -y clean
- apt-get -y autoremove --purge
- echo "Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile" >> /etc/ssh/sshd_config
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages:
- docker.io
snap:
commands:
00: snap install powershell --classic
power_state:
delay: now
mode: reboot
message: Rebooting the OS
Sure, it’s just the case here that cloud-init’s ssh module does not have the functionality you need. You could’ve used write-files
with append: true
, too:
write_files:
- path: /etc/ssh/sshd_config
contents: Subsystem powershell /snap/bin/pwsh -sshs -NoLogo -NoProfile
append: true
Over?
We are working with a slightly different focus - simplicity and usability are our driving goals, but also focus on an ideal experience for Ubuntu instances. We will likely never reach feature parity, but we don’t necessarily want that. We’ll deeply consider it before adding new features - will it make it more confusing to use? Can we make it intuitive and work across all platforms?
Have a look at https://news.ycombinator.com/item?id=21836528 for what our users say about those differences.