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 storedhttps://github.com/librenms/packer-buildsuser-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"
    }
  ]
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值