使用terraform管理Proxmox VE资源
terraform-proxmox
使用terraform管理proxmox资源
Using terraform to manage proxmox resources
env:
Proxmox VE v6.1
Terraform v0.11.14
provider.proxmox v0.1.0
By Elvin ,2020-8-23, http://blog.elvin.vip
git source https://gitee.com/alivv/terraform-proxmox.git
Proxmox VE 安装配置 创建kvm模板
Proxmox VE installation configuration, and create KVM template
https://www.cnblogs.com/elvi/p/13587280.html
# install terraform v0.11.14
wget http://files.elvin.vip/cli/terraform_0.11.14_linux_amd64.zip
unzip -oq terraform_0.11.14_linux_amd64.zip -d /usr/local/bin/
rm -f terraform_0.11.14_linux_amd64.zip
# install terraform-provider-proxmox v0.1.0
wget http://files.elvin.vip/cli/terraform-provider-proxmox_0.1.0_linux_amd64.tar.gz
mkdir -p ~/.terraform.d/plugins
tar -zxf terraform-provider-proxmox_0.1.0_linux_amd64.tar.gz -C ~/.terraform.d/plugins/
rm -f terraform-provider-proxmox_0.1.0_linux_amd64.tar.gz
# clone demo
git clone https://gitee.com/alivv/terraform-proxmox.git /opt/
# test
cd /opt/terraform-proxmox/test
#config pm_api_url,pm_password,clone,storage ...
#vim vm.tf
#test
terraform version
terraform init
terraform plan
#创建VM, 从模板ubuntu克隆vm
#Create VM, Cloning VM from template Ubuntu
terraform apply
#删除VM, Delete VM
terraform destroy
# Terraform template
#使用terraform模板,批量创建VM
#Create VM in batch using terraform template
cd /opt/terraform-proxmox/vm
#vm list
cat > vm.list.txt << EOF
# name,count,cpu,ram,disk,vid,os(default ubuntu),notes(Optional)
vm-ubuntu,2,2,4,20,161,ubuntu
vm-centos,2,4,8,20,163,centos,centos for test
EOF
#make vm.tf and outputs.tf from vm.list.txt
./make.vm.tf.sh
#run check
terraform init
terraform plan
#Create VM
terraform apply
#Run the demo results
# terraform version
Terraform v0.11.14
+ provider.proxmox v0.1.0
# terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
+ module.vm-centos.proxmox_vm_qemu.cloudinit-test[0]
id: <computed>
agent: "1"
balloon: "0"
bios: "seabios"
boot: "cdn"
clone: "centos"
clone_wait: "15"
cores: "4"
cpu: "host"
desc: "centos for test"
disk.#: "1"
disk.1057333298.backup: "false"
disk.1057333298.cache: "none"
disk.1057333298.discard: "on"
disk.1057333298.format: "qcow2"
disk.1057333298.id: "0"
disk.1057333298.iothread: "true"
disk.1057333298.mbps: "0"
disk.1057333298.mbps_rd: "0"
disk.1057333298.mbps_rd_max: "0"
disk.1057333298.mbps_wr: "0"
disk.1057333298.mbps_wr_max: "0"
disk.1057333298.replicate: "false"
disk.1057333298.size: "20G"
disk.1057333298.ssd: ""
disk.1057333298.storage: "data"
disk.1057333298.storage_type: "dir"
disk.1057333298.type: "scsi"
force_create: "false"
full_clone: "true"
hotplug: "network,disk,usb"
ipconfig0: "ip=192.168.21.163/24,gw=192.168.21.1"
kvm: "true"
memory: "8192"
name: "vm-centos-1"
numa: "false"
onboot: "true"
os_type: "cloud-init"
preprovision: "true"
sockets: "1"
ssh_host: <computed>
ssh_port: <computed>
target_node: "n11"
vcpus: "0"
vlan: "-1"
vmid: "163"
+ module.vm-centos.proxmox_vm_qemu.cloudinit-test[1]
...
provider.proxmox source
https://github.com/Telmate/terraform-provider-proxmox/
使用terraform管理Proxmox VE资源的更多相关文章
- Terraform模块Module管理,聚合资源的抽取与复用
我最新最全的文章都在南瓜慢说 www.pkslow.com,欢迎大家来喝茶! 1 简介 最近工作中用到了Terraform,权当学习记录一下,希望能帮助到其它人. Terraform系列文章如下: T ...
- 管理名称空间资源(Kubernetes)
管理名称空间资源 名称空间(Namespace)是Kubernetes集群级别的资源,用于将集群分隔为多个隔离的逻辑分区以配置给不同的用户.租户.环境或项目使用.例如,可以为development.q ...
- sqler 集成 terraform v0.12 生成资源部署文件
terraform v0.12 发布了,有好多新功能的添加,包括语法的增强,新函数的引入,更好的开发提示 只是当前对于一些老版本的provider 暂时还不兼容,但是大部分官方的provider 都是 ...
- 【Azure 环境】在Windows系统中 使用Terraform创建中国区Azure资源步骤(入门级)
Terraform(全称:Hashicorp Terraform )是一种开源工具,用于预配和管理云基础结构. 它将基础结构编入描述云资源拓扑的配置文件中. 这些资源包括虚拟机.存储帐户和网络接口等. ...
- xcode 树形管理 cocos2d-x的资源
把资源以目录的形式加入xcode中, 同时, 在加入时, 选择"Create Folder References for any added folders", 而不是默认的&q ...
- kubernetes---kubectl 管理集群资源
由于我现在的集群是把虚拟机的master文件直接拷贝过来的,所以之前的node节点是不存在的,只有k8s-ubuntu-1是新加入的,所以我要把上面之前创建的资源删除 删除deployment--&g ...
- Unity---资源管理中不同资源的路径获取方式
1.首先需要先了解两个知识点: Unity内置的文件路径获取方式.windows的Directory.GetFiles文件获取方式: 1>Unity内置的文件路径获取方式,一下是官方解释:h ...
- thinkjs框架发布上线PM2管理,静态资源访问配置
一.环境:thinkjs + pm2 二.网站配置: #端口转发 location / { proxy_pass http://127.0.0.1:8368; } #静态资源(很重要) set $no ...
- 利用Marshal来管理非托管资源
void MarshalChartDemo() { string name = "xuwei"; IntPtr pName = Marshal.AllocHGlobal(name. ...
- K8Snode节点管理集群资源方法
1.1 方法1 1.将master的admin.conf 文件拷贝到 node节点 [root@k8s-m ~]#scp /etc/kubernetes/admin.conf root@192.168 ...
随机推荐
- windows 下搭php环境
windows 下搭php环境(php7.2+mysql5.7+apache2.4) 1. 先下载需要的软件 1) 先去微软官网下载vc,我下载的是2017版中文简体的.网址为https://www. ...
- Android 12 关机重启流程
1. 关机流程 Android上层触发关机的入口很多,但最终几乎都是调用ShutdownThread.shutdown来实现.如下是一些常见的调用关机的点: StatusBarManagerServi ...
- 3个步骤轻松集成Push Kit,实现App消息推送
推送通知作为App重要的消息传递工具,广泛应用于电子商务.社交媒体.旅游交通等领域的通知场景.比如当应用有新功能或安全补丁时,系统将推送消息提醒用户及时更新:如果是航班出行类的应用,会发送最新的班次时 ...
- vue前端开发仿钉图系列(6)左侧记事本的开发详解
在页面开发中,深深的被element组件所吸引,里面很多小组件都可以直接使用.像是记事本提示.记事本列表时间线.右侧编辑页面的form表单,编辑和查看状态的切换等等,比之前iOS原生开发所有的东西都要 ...
- OOP的核心思想
1. 封装 既是信息封装,把一些信息进行封装成对象,只保留部分接口和方法与外部联系,能有效避免程序间相互依赖,实现代码模块间松藕合 : 2. 继承 子类自动继承父类的属性和方法,继承实现了代码的重用性 ...
- CRLF the next time Git touches it warning: in the working copy of '', LF will be replaced by CRLF the next time Git touches it warning: in the working copy of
git config --global core.autocrlf true
- 2.flask 源码解析:应用启动流程
目录 一.flask 源码解析:应用启动流程 1.1 WSGI 1.2 启动流程 Flask 源码分析完整教程目录:https://www.cnblogs.com/nickchen121/p/1476 ...
- OpenFunction 0.7.0 发布: OpenFunction Gateway、多语言及 Helm 安装支持
OpenFunction 是一个开源的云原生 FaaS(Function as a Service,函数即服务)平台,旨在帮助开发者专注于业务逻辑的研发.在过去的几个月里,OpenFunction 社 ...
- (系列九)使用Vue3+Element Plus创建前端框架(附源码)
说明 该文章是属于OverallAuth2.0系列文章,每周更新一篇该系列文章(从0到1完成系统开发). 该系统文章,我会尽量说的非常详细,做到不管新手.老手都能看懂. 说明:OverallAuth2 ...
- AI赋能-《用ChatGPT做软件测试》新书上市
图书链接京东: https://item.jd.com/10121763192532.html当当: http://product.dangdang.com/29797547.html内容简介本书以目 ...