使用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 ...
随机推荐
- /proc/pids/io
rchar:代表自进程启动以来所读取的总字符数,包括通过缓存或直接读取的字符.单位是字节(bytes). wchar:代表自进程启动以来所写入的总字符数,包括通过缓存或直接写入的字符.单位是字节(by ...
- 删除 设置 获取 cookies 的第三方包 js-cookies
// 第三方包 js-cookies 是一个操作cookies的包 import Cookies from 'js-cookie' // Cookies.set(key,value) 存值 // Co ...
- 0402-Tensor和Numpy的区别
0402-Tensor和Numpy的区别 目录 一.tensor数据和ndarray数据相互转换 二.广播法则 pytorch完整教程目录:https://www.cnblogs.com/nickch ...
- Office365常用的命令(持续更新中)
Office365常用的命令(持续更新中) 持续更新中............. Enable-ExchangeCertificate -Thumbprint B9C93420E7BEE46C1CD2 ...
- C#通过JS变量提取天天基金API返回的基金净值
目录 天天基金API 添加项目依赖项 请求 API 数据 获取所有基金代码 获取基金净值信息 功能测试 参考链接 天天基金API 常见的 API 如下: 所有基金代码:http://fund.east ...
- 云原生爱好者周刊:Lens 5.2 发布,支持 M1 芯片
云原生一周动态要闻: Lens 5.2 发布 CNI 1.0.1 发布 K8ssandra 从 Helm 迁移到 Operator Amazon EKS Anywhere – 现在普遍可用于在本地创建 ...
- 题解:AT_abc374_d [ABC374D] Laser Marking
题目传送门 luogu观看 思路 注意一下数据范围. \(1 \le n \le 6\) 首先想到 dfs. 按照题意,先算出位置到线段的一段所需的时间. 再算出画线段所需的时间,就行了. 输出后发现 ...
- 带你玩转nginx负载均衡
nginx跨多个应用程序实例的负载平衡是一种用于优化资源利用率,最大化吞吐量,减少延迟和确保容错配置的常用技术. 环境介绍 配置nginx负载均衡器因会用到多台服务器来进行,所以下面我会用到docke ...
- Java高并发之线程的实现方式,含Lamabda表达式
Java中线程实现的方式 在 Java 中实现多线程有4种手段: 1.继承 Thread 类 2.实现 Runnable 接口 3.匿名内部类 4.Lambda表达式实现 实现 Runnable 接口 ...
- 学习JavaScript第二天
文章目录 1.运算符(操作符) 1.1运算符的分类 1.2算数运算符 1.3递增和递减运算符 1.4比较运算符 1.5逻辑运算符 2.选择结构 2.1if语句 2.1.1语法 2.1.2案例1:判断闰 ...