1

I am new with Cloud-Init, I am trying to install tailscale and Docker with it, and some other packages

I tried several times and no luck and no error logs.

What I am doing wrong?

Here is my script:

#cloud-config

users: - name: ubuntu shell: /usr/bin/bash ssh_import_id: gh:skhaz sudo: ALL=(ALL:ALL) NOPASSWD:ALL

chpasswd: expire: false

apt_upgrade: true

apt: sources: docker source: deb [arch=amd64 trusted=yes] https://download.docker.com/linux/ubuntu focal stable tailscale: source: deb [arch=amd64 trusted=yes] https://pkgs.tailscale.com/stable/ubuntu focal main

packages: - docker-ce - tailscale - aria2 - build-essential - vim - tmux

runcmd: - tailscale up -authkey='REDACTED'

- ufw --force reset
- ufw allow in on tailscale0 to any
- ufw --force

Rodrigo
  • 75

1 Answers1

1

If your yaml pasted correctly, your indentation is wrong and you're missing a : on your docker line:

Try this:

#cloud-config

users: - name: ubuntu shell: /usr/bin/bash ssh_import_id: gh:skhaz sudo: ALL=(ALL:ALL) NOPASSWD:ALL

chpasswd: expire: false

apt_upgrade: true

apt: sources: docker: source: deb [arch=amd64 trusted=yes] https://download.docker.com/linux/ubuntu focal stable tailscale: source: deb [arch=amd64 trusted=yes] https://pkgs.tailscale.com/stable/ubuntu focal main

packages: - docker-ce - tailscale - aria2 - build-essential - vim - tmux

runcmd: - tailscale up -authkey='REDACTED'

- ufw --force reset
- ufw allow in on tailscale0 to any
- ufw --force

Notice the indentation on lines 5-7, and the : at the end of line 16.

In general, for debugging cloud-init, there's a command to check your #cloud-config against a schema. On the launched instance you can run cloud-init schema --system. Also, you can check /var/log/cloud-init.log for any WARNING or Traceback. The log can be fairly verbose, but that can at least give you a starting point.

cloud-init schema docs: https://cloudinit.readthedocs.io/en/latest/topics/cli.html#schema

falcojr
  • 386