使用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 ...
随机推荐
- Centos LNMP 安装日记
环境介绍 [root@k8s-master ~]# cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core) mysql8.0.12_b ...
- 图片的穿透效果 -- pointer-events: none
使用场景:当我们需要选择上传文件的时候,图片把input输入框覆盖在上面,点击的时候不能出发input输入框所以要给图片设置穿透属性 : 具体代码: #image { position: fixed; ...
- kali Linux及mac os 破解WiFi
wpa-dictionary 用于 Wi-Fi 密码破解. Linux 篇(推荐) 1. 安装 aircrack-ng 使用相应包管理工具安装,例如 Debian/Ubuntu 使用 apt 安装: ...
- vue3+tpyeScript + element plus 三级复选框,全选控制全部,左侧选中控制右侧全选
.markdown-body { line-height: 1.75; font-weight: 400; font-size: 16px; overflow-x: hidden; color: rg ...
- PHP将整形数字转为Excel下标
1.背景 这两天在接到一个需求,需要导出一个班级所有学员的所有成绩,在最后excel表处理的时候发现导出的列超过了26列,后面会出现AA之类的下标,所以写了一个函数把数字整型转为Excel对应的下标. ...
- 基础控件(ListView,RecyclerView,单位和尺寸,ViewPager,ViewPager2)
ListView list_item.xml <?xml version="1.0" encoding="utf-8"?> <LinearLa ...
- LiveData
ViewModel 添加依赖 implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' activity_main.xml < ...
- 掀起云端革命!ToDesk云电脑与传统PC电脑的差异分析
在科技日新月异的今天,传统PC电脑的市场地位正悄然发生变化.随着云计算技术的不断成熟与普及,云电脑逐渐走进大众视野,不同于传统PC电脑的高昂的成本和易退化的硬件性能,云电脑正以其轻成本高性能的优势吸引 ...
- 微积分 Calculus
前言 如果你的工作中没有用到微积分,毫无疑问,你的工作是简单而枯燥的. 0 limit Say there is a function \(f(x) = x\). \(x \rightarrow a\ ...
- 如果让你处理hbase 怎么保证数据的安全性可靠性 不需要具体的设置 要一套方案
有关数据安全及可靠我们认为大体上分为存储安全和使用安全 1 数据存储安全 hbase是基于hdfs的一种数据存储解决方案,所以有关数据的安全性可靠性可以利用hdfs自身的副本机制保障.另外原生的hba ...