Guest User

cloud init rancher OS vultr

a guest
Nov 24th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.35 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. V4_PRIVATE_IP=`wget -q -O - http://169.254.169.254/current/meta-data/local-ipv4`
  4. V4_PUBLIC_IP=`wget -q -O - http://169.254.169.254/current/meta-data/public-ipv4`
  5.  
  6. cat > "cloud-config.yaml" <<EOF
  7. #cloud-config
  8. hostname: ptl-www-rancher
  9. ssh_authorized_keys:
  10.   - ssh-rsa AAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx....
  11. write_files:
  12.   - path: /home/rancher/.docker/config.json
  13.     permissions: "0600"
  14.     content: |
  15.       {"auths": {"https://index.docker.io/v1/": {"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "email": "[email protected]"}}}
  16.   - path: /etc/ssh/sshd_config
  17.     permissions: "0600"
  18.     owner: root:root
  19.     content: |
  20.       Port 2222
  21.       AuthorizedKeysFile .ssh/authorized_keys
  22.       UsePrivilegeSeparation sandbox
  23.       ClientAliveInterval 180
  24.       Subsystem sftp /usr/libexec/sftp-server
  25.       UseDNS no
  26.       PermitRootLogin no
  27.       AllowGroups docker
  28. rancher:
  29.   cloud_init:
  30.     datasources:
  31.       - ec2
  32.   network:
  33.     dns:
  34.       nameserver:
  35.         - 8.8.4.4
  36.         - 4.2.2.3
  37.     interfaces:
  38.       eth0:
  39.         dhcp: true
  40.       eth1:
  41.         address: $V4_PRIVATE_IP/16
  42.         mtu: 1450
  43.   state:
  44.    fstype: auto
  45.    dev: LABEL=RANCHER_STATE
  46.    autoformat:
  47.      - /dev/vda
  48. EOF
  49. sudo ros install --no-reboot -f -c cloud-config.yaml -d /dev/vda
  50. sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment