Skip to content

Cloud-Init Configuration Documentation

This cloud-init configuration is used to initialize a virtual machine (VM) on Terraform. It sets up a user, updates and upgrades the system packages, installs necessary packages, and runs several commands.

User Setup

The configuration creates a user named ansible with the following properties:

  • The user is added to the users and admin groups.
  • The user is granted sudo privileges without the need for a password.
  • The user's default shell is set to /bin/bash.
  • An SSH public key is added to the user's authorized keys.
users:
  - name: ansible
    groups: users, admin
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_authorized_keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCq8c4ByK/AiDCeep1xdwaq3Hv3Rxbqga0iB3VPMENE7AEBpwExDGxUXUbYEOjTfy1aNhupHp4GVwIeL/WDQzPbSgnbT9RVqjhMm+XdWoaX+0c2v32Q8UBYvFsh44bhEW+GqHPjEX0Z1ee+BdcPkvo7pSFQW8Uyfahe0dw9mVHKHsgQAbPVReHcaisWgQxHoC7lSvPbBXsUxljyuh0QtAI717LDaQQeWLsBSffZsa4AfdZUYWjHl/sBmGWRVW8Bgj1L4rXEWce0mhzJn0hztcMI6ihaM9b1oxBf+sidIKlQQhQfzohgvhT73vY1eaHf7nbfFPsI5LOo3TrY5McgC8DpeUrf0nxIEaQsztKP4kqWmL4wogSu4NiaNqZqUuw/tAKcGd06VkNwEr+KqLqeBYuM09i3sJ9jUiE1q3f/1ARNrN27E8UbcQSCIDGYsJxD6Xun0lcXnz1o8mHJWIF2JkqxuIiL0SpdP+cjUvsPYbCiU7H9dChB+gomSYzLCpdY+a0= ansible@ansible

Package Update and Upgrade

The system packages are updated and upgraded:

package_update: true
package_upgrade: true
Package Installation The ufw package is installed:
packages:
  - ufw

Run Commands

Several commands are run to set up Netdata, enable UFW, allow SSH through UFW, and set up Docker Compose:

runcmd:
  - wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel --claim-token tW9WbpTLZxBFzSu_TsMDyam0JnyqzoQPJ4xnThObws --claim-rooms 0d72f373-62bc-4208-ad9d-d299eafe7b3b --claim-url https://app.netdata.cloud
  - ufw allow 'OpenSSH'
  - ufw enable
  - mkdir -p /home/ansible/.docker/cli-plugins/
  - wget -O /tmp/docker-compose https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-linux-aarch64
  - cp /tmp/docker-compose /home/ansible/.docker/cli-plugins/docker-compose
  - chown ansible:ansible -R /home/ansible/.docker
  - chmod +x /home/ansible/.docker/cli-plugins/docker-compose