微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LibreNMS使用Packer为 VMware Workstation Pro自动化构建Ubuntu 20.04 虚拟机映像

GitHub - librenms/packer-builds: This repo is where virtual images are created and storedThis repo is where virtual images are created and stored - GitHub - librenms/packer-builds: This repo is where virtual images are created and stored

https://github.com/librenms/packer-builds

user-data

#cloud-config
autoinstall:
  version: 1
  user-data:
    hostname: librenms
    users:
      - name: vagrant
        passwd: $6$p7TmlCd1WIljlXVE$B8Yr1f6eVvQrlE5qsk3dp6heo1YveUdXBzXwYY5bhMlbcyl9rvZtH0AkW1ntiE2jgYA8GEQ4vx/lsjxYNwHuK.
        lock-passwd: false
        groups: sudo
        shell: /bin/bash
        sudo: "ALL=(ALL) nopASSWD:ALL"
      - name: ubuntu
        passwd: $6$p7TmlCd1WIljlXVE$B8Yr1f6eVvQrlE5qsk3dp6heo1YveUdXBzXwYY5bhMlbcyl9rvZtH0AkW1ntiE2jgYA8GEQ4vx/lsjxYNwHuK.
        lock-passwd: false
        groups: sudo
        shell: /bin/bash
        sudo: "ALL=(ALL) nopASSWD:ALL"
    locale: en_US
  ssh:
    allow-pw: true
    install-server: true
  storage:
    layout:
      name: lvm

ubuntu-2004.json

{
  "builders": [
    {
      "name": "ubuntu-2004","type": "vmware-iso","guest_os_type": "ubuntu-64","headless": false,"iso_url": "file://F:\\ubuntu-20.04.2-live-server-amd64.iso","iso_checksum": "aba7e22636c435c5008f5d059ae69a62","shutdown_command": "sudo systemctl poweroff","ssh_username": "vagrant","ssh_password": "vagrant","ssh_timeout":"60h","ssh_handshake_attempts": "20000","http_directory": "http","memory": 2048,"boot_wait": "5s","boot_command": [
        "<enter><enter><f6><esc><wait> ","autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/","<enter>"
      ]
    }
  ],"provisioners": [
    {
      "destination": "/tmp/librenms.conf","source": "files/ubuntu/librenms.conf","type": "file"
    },{
      "environment_vars": [
        "DEBIAN_FRONTEND=noninteractive","DESKTOP={{user `desktop`}}","UPDATE={{user `update`}}","INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}","SSH_USERNAME={{user `ssh_username`}}","SSH_PASSWORD={{user `ssh_password`}}","http_proxy={{user `http_proxy`}}","https_proxy={{user `https_proxy`}}","no_proxy={{user `no_proxy`}}","LIBRENMS_VERSION={{user `librenms_version`}}","OXIDIZED={{user `oxidized`}}","SYSLOG_NG={{user `syslog_ng`}}"
      ],"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'","expect_disconnect": true,"scripts": [
        "scripts/ubuntu/update.sh","scripts/ubuntu/virtualBox.sh","scripts/ubuntu/vmware.sh","scripts/common/vagrant.sh","scripts/common/sshd.sh","scripts/ubuntu/librenms.sh","scripts/ubuntu/syslog-ng.sh","scripts/ubuntu/oxidized.sh","scripts/ubuntu/cleanup.sh","scripts/common/finish.sh","scripts/ubuntu/minimize.sh","scripts/common/clean_users.sh"
      ],"type": "shell"
    }
  ]
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐