Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ubuntu 20.04 server autoinstallation HowTo
#6
Thank you, I have confirmed it works. I can paste a much complex version

Code:
#cloud-config
autoinstall:
  apt:
    geoip: true
    preserve_sources_list: false
    primary:
      - arches: [default]
        uri: http://mirrors.ustc.edu.cn/ubuntu
  early-commands:
    # otherwise packer tries to connect and exceed max attempts
    - systemctl stop ssh
  interactive-sections:
    - network
    - storage
  keyboard: {layout: us, toggle: null, variant: ''}
  late-commands:
    # never put "mkdir -p /etc/cloud && touch /etc/cloud/cloud-init.disabled" here
    - echo "600g2" >/target/etc/hostname
    - 'sed -i -e "s/dhcp4: false/dhcp4: true/" /target/etc/netplan/00-installer-config.yaml'
    - rm -f /target/etc/systemd/system/snapd.service.d/snap_proxy.conf
    - sed -i -e "/^GatewayPorts no$/d" /target/etc/ssh/sshd_config
    - touch /target/etc/ssh/sshd_config.d/custom.conf
    - echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config.d/custom.conf
    - echo "GatewayPorts yes" >>/target/etc/ssh/sshd_config.d/custom.conf
  locale: en_US.UTF-8
  network:
    bonds:
      bond0:
        dhcp4: false
        interfaces:
          - eno1
        parameters:
          mode: active-backup
    ethernets:
      eno1: {}
    version: 2
    wifis:
      wlp1s0:
        access-points:
          XAP3007GC: {password: 1234567890}
        dhcp4: true
  refresh-installer: {update: no}
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: true
  updates: security
  user-data:
    disable_root: false
    power_state: {condition: true, delay: '+1', mode: poweroff}
    runcmd:
      - [mkdir, -p, /etc/cloud]
      - [touch, /etc/cloud/cloud-init.disabled]
      - [systemctl, enable, ssh]
    users:
      - name: vagrant
        gecos: vagrant
        primary_group: users
        groups: [adm, cdrom, sudo, dip, plugdev, lxd]
        lock_passwd: false
        # The password is ubuntu
        passwd: $6$55MZmOQiyc.l6/K2$vkC8y.YECFHz9lRI/wq8ZPkfU/2DFxjYygWIn8XVFWEsUOr.nfbpGDVDiS/wt07dIaRV//5XAxH1JVYU99TDs/
        shell: /bin/bash
        ssh_authorized_keys:
          - "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
        sudo: ALL=(ALL) NOPASSWD:ALL
  version: 1
Reply


Messages In This Thread
RE: Ubuntu 20.04 server autoinstallation HowTo - by liaoya - 02-20-2022, 04:02 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)