Skip to content
Snippets Groups Projects
user_data.tmpl 1.59 KiB
Newer Older
Rob Kooper's avatar
Rob Kooper committed
#cloud-config

# SSH config
no_ssh_fingerprints: false
ssh:
  emit_keys_to_console: false

# update and upgrade instance
package_update: true
package_upgrade: true

# set timezone
timezone: America/Chicago

Rob Kooper's avatar
Rob Kooper committed
# files to be created on the system
write_files:
- path: /etc/fstab
  permissions: "0644"
  owner: root:root
  content: |
Rob Kooper's avatar
Rob Kooper committed
    taiga-nfs.ncsa.illinois.edu:/taiga/ncsa/radiant/${project_name}/${cluster_name} /taiga nfs defaults 0 0
Rob Kooper's avatar
Rob Kooper committed
  append: true
- path: /etc/docker/daemon.json
  permissions: "0644"
  owner: root:root
  content: |
    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m"
      },
      "storage-driver": "overlay2"
    }
- path: /usr/local/bin/rke1
  permissions: "0700"
  owner: root:root
  content: |
    #!/usr/bin/bash
    echo "sleeping to wait for network"
    while ! ping -c 1 -w 0  1.1.1.1 > /dev/null ; do echo "Sleep 10s"; sleep 10; done
Rob Kooper's avatar
Rob Kooper committed
    echo "install iscsi/nfs"
    if [ -e /usr/bin/yum ]; then
      yum -y install iscsi-initiator-utils nfs-utils
    elif [ -e /usr/bin/apt ]; then
      apt install -y open-iscsi nfs-common
    else
      echo "Don't know how to install iscsi/nfs"
    fi
Rob Kooper's avatar
Rob Kooper committed
    echo "install docker"
Rob Kooper's avatar
Rob Kooper committed
    curl https://releases.rancher.com/install-docker/24.0.sh | sh
Rob Kooper's avatar
Rob Kooper committed
    systemctl enable docker
    systemctl start docker
    usermod -aG docker ${username}
Rob Kooper's avatar
Rob Kooper committed
    echo "connect to rancher"
    ${node_command} ${node_options} ${node_labels}
Rob Kooper's avatar
Rob Kooper committed
    echo "mounting taiga"
    mkdir /taiga
    #mount -av
Rob Kooper's avatar
Rob Kooper committed
    echo "all done"

# run this command once the system is booted
runcmd:
- /usr/local/bin/rke1