remote-init.tpl.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #cloud-config
  2. datasource:
  3. Ec2:
  4. strict_id: false
  5. write_files:
  6. - content: |
  7. network:
  8. version: 2
  9. ethernets:
  10. eth0:
  11. dhcp4: true
  12. path: /etc/netplan/eth.yaml
  13. permissions: '0755'
  14. - content: |
  15. config setup
  16. charondebug="all"
  17. uniqueids=yes
  18. strictcrlpolicy=no
  19. conn remote-to-cloud
  20. authby=secret
  21. left=%defaultroute
  22. leftid="${remote_addr}"
  23. leftsubnet=192.168.0.0/24
  24. right="${vpn_addr}"
  25. rightsubnet=10.0.0.0/8
  26. keyingtries=0
  27. ikelifetime=28800
  28. lifetime=86400
  29. auto=start
  30. keyexchange=ikev2
  31. ike=3des-sha1-modp1536!
  32. esp=3des-sha1!
  33. forceencaps=yes
  34. type=tunnel
  35. path: /etc/ipsec.conf
  36. owner: root
  37. permissions: '0755'
  38. - content: |
  39. "${remote_addr}" "${vpn_addr}" : PSK ${ipsec_pass}
  40. path: /etc/ipsec.secrets
  41. owner: root
  42. permissions: '0755'
  43. runcmd:
  44. - netplan generate /etc/netplan/eth.yaml
  45. - netplan apply
  46. users:
  47. - default
  48. - name: yc-user
  49. groups: wheel
  50. shell: /bin/bash
  51. sudo: ALL=(ALL) NOPASSWD:ALL
  52. ssh_authorized_keys:
  53. - "${ssh_key}"
  54. packages:
  55. - netplan.io
  56. - iperf3
  57. - hping3
  58. - openssh-server
  59. - mongodb
  60. package_update: true
  61. package_reboot_if_required: true