使用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 ...
随机推荐
- 流式dma和一致性dma的区别
流式 DMA(Streaming DMA)和一致性 DMA(Consistent DMA)是两种不同的内存映射模式,用于 DMA(直接内存访问)操作.它们的主要区别在于缓存一致性.性能和使用场景.以下 ...
- /proc/pids/maps
本实例中的用户空间地址从 0x00000000 到 0x80000000,从地址空间划分可知,从低到高依次是: 可执行文件的代码段.数据段.BSS段. 堆heap. 文件映射和匿名映射,包括vdso. ...
- 2021年6月国产数据库排行榜:OceanBase、PolarDB会师TiDB、openGauss,入局开源阵营,逐鹿生态建设
"首夏犹清和,芳草亦未歇",时至六月,百花齐放.百家争鸣的国产数据库市场依旧延续着如骄阳般火热的态势.不过从最新一期的 国产数据库流行度排行榜 Top 10 中不难发现,一个词足以 ...
- Linux环境下的mysql安装
MySQL8.0.26-Linux版安装 1.准备一台Linux服务器 云服务器或者虚拟机都可以; Linux的版本为 Centos7; 2.下载Linux版MySQL安装包 https://down ...
- [离线计算-Spark|Hive] 大数据应用性能指标采集工具改造落地
背景 主要介绍针对平台的spark应用程序,在不修改用户程序的情况下 如何采集其资源和性能指标为后续分析使用,如性能优化,资源使用计价等. 分析挑战 在应用程序级别关联大量进程的指标 在分布式环境中, ...
- Go语言切片(Slice)的一些有趣特性
切片类似数组的引用.更改底层数组中的元素会修改切片的元素.更改切片的元素同样会修改其底层数组中的元素,和它共享底层数组的切片都会观测到这些修改. 点击查看代码 package main import ...
- Maven的顶级功能——依赖管理
依赖管理 依赖管理解决的问题 我们学完一个语言的语法之后,我们应该都能知道函数的引用或者类的创建等了.为了方便管理,我们就会把一些特定的功能实现写在一个代码文件中,我们只需要使用的时候导入就行了,这样 ...
- 弱口令、子域名、md5、伪随机数、目录爆破与CTF实战
web 21--弱口令爆破&custom iterator 进去要求输入账号密码,账号输入admin,一般来说管理员用户名都会是这个,密码随便输,然后burpsuite抓包 可以看到账号密码在 ...
- cgo:go数组转c数组调用c函数
package main /* #include <stdio.h> void processInt2DArray(int* arr, int rows, int cols) { for ...
- centos7-arm架构yum源(armhf) yum源(中国科学技术大学)
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # upda ...