|
|
第1行: |
第1行: |
− | [[category:ops]] [[category:devops]] | + | [https://i.linuxtoy.org/docs/guide/index.html 开源世界旅行手册] |
| | | |
− | =ins= | + | ==ops== |
− | <pre>
| + | trac是一个开源软件平台,集成了Wiki和问题跟踪管理系统。Trac以简单的方式建立了一个软件项目管理的Web应用,以帮助开发人员更好地写出高质量的软件。Trac采用Python语言开发的,因此Trac的在运行的时候,需要有Python环境的支持。 |
| | | |
− | wget -c https://releases.hashicorp.com/terraform/0.15.4/terraform_0.15.4_linux_amd64.zip
| + | === bug=== |
− |
| + | https://www.mantisbt.org/ |
− | unzip terraform_0.15.4_linux_amd64.zip
| |
− | #sudo mv terraform /usr/bin/
| |
− | mkdir /home/evan/data/apps/terraform && mv terraform /home/evan/data/apps/terraform/
| |
− | echo 'export PATH=/home/evan/data/apps/terraform:$PATH' >> /etc/profile
| |
− |
| |
− | echo 'export PATH=/home/evan/data/apps/:$PATH' >> /etc/profile #这个不行 少了一个目录 找不到了
| |
− |
| |
− | 写在你的home ~/.profile 也是可以的 为你本用户使用方便
| |
− | export PATH=/home/evan/data/apps/terraform:$PATH
| |
| | | |
− | #if APT Packages for Debian and Ubuntu
| + | eg |
− | curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
| + | bugs.centos.org |
− | 216 sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
| |
− | 218 apt update
| |
− | 219 sudo apt install terraform
| |
| | | |
| + | ===Mailman=== |
| | | |
− | </pre>
| + | Mailman, the GNU Mailing List Manager |
− |
| + | https://www.gnu.org/software/mailman/index.html |
− |
| |
− | [https://blog.csdn.net/daiqinge/article/details/103798557?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control\&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control terraform的安装和应用 ]
| |
| | | |
− | =usage= | + | ==办公== |
− | = usage on aliyun= | + | 协同办公软件,叫[http://www.ranzhi.org/ 然之]。用过管理软件的都知道,工作任务指派,项目进度情况一目了然,节省了很多当面沟通询问的时间。 |
− | 以aliyun作为例子
| |
| | | |
− | <pre>
| + | ==在线生成二维码== |
− | #把相关密码写入 不是写在文本 安全一点吧
| + | [https://tool.oschina.net/qr 在线生成二维码(QR码)] |
− | export ALICLOUD_ACCESS_KEY="LTAIUrZCw3********"
| |
− | export ALICLOUD_SECRET_KEY="zfwwWAMWIAiooj14GQ2*************"
| |
− | export ALICLOUD_REGION="cn-guangzhou"
| |
− | </pre>
| |
| | | |
| + | ==blog== |
| + | http://octopress.org/ |
| | | |
| + | ==win== |
| + | === WizTree=== |
| + | WizTree中文版是世界上最快的磁盘空间分析器 |
| | | |
− | <pre>
| + | C盘飘红令人脑壳痛?试试堪称神器的硬盘清理小工具WizTree |
− | evan@myxps:~/.terraform.d$ cat terraform.tf
| |
− | resource "alicloud_vpc" "vpc" {
| |
− | vpc_name = "tf_test_foo"
| |
− | cidr_block = "172.16.0.0/12"
| |
− | }
| |
| | | |
− | resource "alicloud_vswitch" "vsw" {
| + | https://www.cnbeta.com/articles/soft/1131357.htm |
− | vpc_id = alicloud_vpc.vpc.id
| |
− | cidr_block = "172.16.0.0/21"
| |
− | zone_id = "cn-guangzhou-b"
| |
− | }
| |
| | | |
| + | https://pc.qq.com/detail/2/detail_24422.html |
| + | ===防火墙=== |
| + | [https://www.zonealarm.com/software/free-firewall/ ZoneAlarm Free Firewall 2018下载] |
| | | |
− | evan@myxps:~/.terraform.d$ terraform init #自动安装了alicloud provider plugis
| + | 我用得最多就是来禁止wps服务 在设置哪里 |
| | | |
− | Initializing the backend...
| + | [http://soft.yesky.com/security/bdzq/47/2017047.shtml 为电脑保驾护航 最佳个人防火墙ZoneAlarm配置] |
| | | |
− | Initializing provider plugins...
| + | [http://www.filseclab.com/zh-cn/downloads.htm 费尔个人防火墙专业版] |
− | - Finding latest version of hashicorp/alicloud...
| |
− | - Installing hashicorp/alicloud v1.124.0... | |
| | | |
| + | ===压缩=== |
| + | [https://www.bandisoft.com/bandizip/cn/ Bandizip : 轻巧、快速、免费的压缩软件] |
| | | |
− | Terraform has created a lock file .terraform.lock.hcl to record the provider
| + | ===浏览器=== |
− | selections it made above. Include this file in your version control repository
| + | [https://www.mozilla.org/zh-CN/firefox/all/ firefox] |
− | so that Terraform can guarantee to make the same selections by default when
| |
− | you run "terraform init" in the future.
| |
| | | |
− | ╷
| + | === 镜像制作=== |
− | │ Warning: Additional provider information from registry
| + | win 32 diskimager |
− | │
| |
− | │ The remote registry returned warnings for
| |
− | │ registry.terraform.io/hashicorp/alicloud:
| |
− | │ - For users on Terraform 0.13 or greater, this provider has moved to
| |
− | │ aliyun/alicloud. Please update your source in required_providers.
| |
− | ╵
| |
| | | |
− | Terraform has been successfully initialized!
| + | == 杀毒== |
| + | https://www.clamav.net/documents/installing-clamav |
| | | |
− | You may now begin working with Terraform. Try running "terraform plan" to see
| + | [https://wiki.archlinux.org/index.php/ClamAV_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) ClamAV (简体中文)] |
− | any changes that are required for your infrastructure. All Terraform commands
| + | ==工作流引擎== |
− | should now work.
| + | [https://www.oschina.net/news/148622/tpflow-5-0-9-released PHP 开源工作流引擎 Tpflow V5.0.9 正式版发布] |
| + | ==手机== |
| + | 360安全换机 |
| | | |
− | If you ever set or change modules or backend configuration for Terraform,
| + | ==高级== |
− | rerun this command to reinitialize your working directory. If you forget, other
| + | [https://electronjs.org/ 使用 Electron 构建跨平台的桌面应用] |
− | commands will detect it and remind you to do so if necessary.
| |
| | | |
− | | + | [[category:desktop]] |
− | terraform apply #
| |
− | | |
− | evan@myxps:~/.terraform.d$ terraform apply
| |
− | alicloud_vpc.vpc: Refreshing state... [id=vpc-7xvsw3jjadaf53zjlido6]
| |
− | | |
− | Terraform used the selected providers to generate the following execution plan.
| |
− | Resource actions are indicated with the following symbols:
| |
− | + create
| |
− | | |
− | Terraform will perform the following actions:
| |
− | | |
− | # alicloud_vswitch.vsw will be created
| |
− | + resource "alicloud_vswitch" "vsw" {
| |
− | + availability_zone = (known after apply)
| |
− | + cidr_block = "172.16.0.0/21"
| |
− | + id = (known after apply)
| |
− | + name = (known after apply)
| |
− | + status = (known after apply)
| |
− | + vpc_id = "vpc-7xvsw3jjadaf53zjlido6"
| |
− | + vswitch_name = (known after apply)
| |
− | + zone_id = "cn-guangzhou-b"
| |
− | }
| |
− | | |
− | Plan: 1 to add, 0 to change, 0 to destroy.
| |
− | | |
− | Do you want to perform these actions?
| |
− | Terraform will perform the actions described above.
| |
− | Only 'yes' will be accepted to approve.
| |
− | | |
− | Enter a value: yes
| |
− | | |
− | alicloud_vswitch.vsw: Creating...
| |
− | alicloud_vswitch.vsw: Creation complete after 6s [id=vsw-7xvwa2oq0fsjm3xuhv9ss]
| |
− | | |
− | Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
| |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | https://vpc.console.aliyun.com/vpc/cn-guangzhou/vpcs
| |
− | 打开 web 有了
| |
− | | |
− | terraform show ##查看已创建的专有网络和交换机
| |
− | | |
− | # alicloud_vpc.vpc:
| |
− | resource "alicloud_vpc" "vpc" {
| |
− | cidr_block = "172.16.0.0/12"
| |
− | id = "vpc-7xvsw3jjadaf53zjlido6"
| |
− | name = "tf_test_foo"
| |
− | route_table_id = "vtb-7xvjpppz3q8kin5vi081k"
| |
− | router_id = "vrt-7xvi5nvfqmvg0mox9rj5j"
| |
− | router_table_id = "vtb-7xvjpppz3q8kin5vi081k"
| |
− | secondary_cidr_blocks = []
| |
− | status = "Available"
| |
− | user_cidrs = []
| |
− | vpc_name = "tf_test_foo"
| |
− | }
| |
− | | |
− | # alicloud_vswitch.vsw:
| |
− | resource "alicloud_vswitch" "vsw" {
| |
− | availability_zone = "cn-guangzhou-b"
| |
− | cidr_block = "172.16.0.0/21"
| |
− | id = "vsw-7xvwa2oq0fsjm3xuhv9ss"
| |
− | status = "Available"
| |
− | vpc_id = "vpc-7xvsw3jjadaf53zjlido6"
| |
− | zone_id = "cn-guangzhou-b"
| |
− | }
| |
− | | |
− | 2 在上一步创建的专有网络中创建一个安全组,并添加一个允许任何地址访问的安全组规则。
| |
− | 在terraform.tf文件中增加以下内容。
| |
− | resource "alicloud_security_group" "default" {
| |
− | name = "default"
| |
− | vpc_id = alicloud_vpc.vpc.id
| |
− | }
| |
− | | |
− | resource "alicloud_security_group_rule" "allow_all_tcp" {
| |
− | type = "ingress"
| |
− | ip_protocol = "tcp"
| |
− | nic_type = "intranet"
| |
− | policy = "accept"
| |
− | port_range = "1/65535"
| |
− | priority = 1
| |
− | security_group_id = alicloud_security_group.default.id
| |
− | cidr_ip = "0.0.0.0/0"
| |
− | }
| |
− | 运行terraform apply #开始创建。 有时time out 再来一次就好了
| |
− | 运行terraform show查看已创建的安全组和安全组规则。
| |
− | 您也可以登录ECS控制台查看安全组和安全组规则。
| |
− | https://ecs.console.aliyun.com/?spm=5176.10483814.recommend.decs.78e6124322cN4j#/securityGroup/region/cn-guangzhou
| |
− | | |
− | 3.创建ECS实例。
| |
− | 在terraform.tf文件中增加以下内容。
| |
− | resource "alicloud_instance" "instance" {
| |
− | # cn-beijing
| |
− | availability_zone = "cn-beijing-b"
| |
− | security_groups = alicloud_security_group.default.*.id
| |
− | | |
− | # series III 能找个最小的么 ecs.s6-c1m1.small
| |
− | instance_type = "ecs.s6-c1m1.small"
| |
− | #instance_type = "ecs.n2.small"
| |
− | system_disk_category = "cloud_efficiency"
| |
− | image_id = "ubuntu_18_04_64_20G_alibase_20190624.vhd"
| |
− | instance_name = "test_foo"
| |
− | vswitch_id = alicloud_vswitch.vsw.id
| |
− | internet_max_bandwidth_out =10
| |
− | password = "$Eevan2240881"
| |
− | }
| |
− | | |
− | 说明
| |
− | 在上述示例中,指定了internet_max_bandwidth_out= 10,因此会自动为实例分配一个公网IP。
| |
− | 详细的参数解释请参见
| |
− | | |
− | image_id 指定ubuntu_16_0402_32,最终会匹配ubuntu_16_0402_32_40G_alibase_20170711.vhd。
| |
− | | |
− | </pre>
| |
− | | |
− | == 最终比较完整的配置文件 ==
| |
− | <pre>
| |
− | evan@myxps:~/.terraform.d$ cat terraform.tf
| |
− | resource "alicloud_vpc" "vpc" {
| |
− | vpc_name = "tf_test_foo"
| |
− | cidr_block = "172.16.0.0/12"
| |
− | }
| |
− | | |
− | resource "alicloud_vswitch" "vsw" {
| |
− | vpc_id = alicloud_vpc.vpc.id
| |
− | cidr_block = "172.16.0.0/21"
| |
− | zone_id = "cn-guangzhou-b"
| |
− | }
| |
− | | |
− | resource "alicloud_security_group" "default" {
| |
− | name = "default"
| |
− | vpc_id = alicloud_vpc.vpc.id
| |
− | }
| |
− | | |
− | resource "alicloud_security_group_rule" "allow_all_tcp" {
| |
− | type = "ingress"
| |
− | ip_protocol = "tcp"
| |
− | nic_type = "intranet"
| |
− | policy = "accept"
| |
− | port_range = "1/65535"
| |
− | priority = 1
| |
− | security_group_id = alicloud_security_group.default.id
| |
− | cidr_ip = "0.0.0.0/0"
| |
− | }
| |
− | | |
− | #ec2 create
| |
− | resource "alicloud_instance" "instance" {
| |
− | # cn-beijing
| |
− | availability_zone = "cn-guangzhou-b"
| |
− | security_groups = alicloud_security_group.default.*.id
| |
− | | |
− | # series III 能找个最小的么 ecs.s6-c1m1.small
| |
− | instance_type = "ecs.s6-c1m1.small"
| |
− | #instance_type = "ecs.n2.small"
| |
− | system_disk_category = "cloud_efficiency"
| |
− | image_id = "centos_7_9_x64_20G_alibase_20201228.vhd"
| |
− | instance_name = "test_foo"
| |
− | vswitch_id = alicloud_vswitch.vsw.id
| |
− | internet_max_bandwidth_out =10
| |
− | password = "$1234567890"
| |
− | }
| |
− | | |
− | </pre>
| |
− | | |
− | | |
− | [https://www.cnblogs.com/rongfengliang/p/7768142.html terraform 阿里云基本使用 ]
| |
− | | |
− | [https://help.aliyun.com/document_detail/95829.html?spm=a2c4g.11186623.2.13.77be16f28uYjgB 创建一台ECS实例]
| |
− | | |
− | [https://blog.csdn.net/cr7258/article/details/114555938 Terraform一键部署ECS实例]
| |
− | | |
− | | |
− | | |
− | [https://developer.aliyun.com/article/713099 玩转阿里云 Terraform(一):Terraform 是什么]
| |
− | | |
− | [https://www.cnblogs.com/rongfengliang/p/7768142.html terraform 阿里云基本使用]
| |
− | | |
− | 进阶
| |
− | | |
− | [https://github.com/terraform-alicloud-modules/terraform-alicloud-ecs-instance/blob/master/README-CN.md terraform-alicloud-modules / terraform-alicloud-ecs-instance官方] | |
− | | |
− | https://registry.terraform.io/modules/alibaba/ecs-instance/alicloud/latest
| |
− | =qqcloud=
| |
− | <pre>
| |
− | NOTES 将秘钥直接填入到.tf文件中是十分不安全的,在多用户共同管理资源时,不建议把腾讯云API 的秘钥直接写到源代码里,以免一不小心更新到公开的版本中,造成安全风险。
| |
− | | |
− | 腾讯云提供了另一种更为安全可靠的方式,把秘钥信息放在环境变量中配置
| |
− | | |
− | // Configure the secret key in the environment path
| |
− | $ export TENCENTCLOUD_SECRET_ID="your_fancy_accessid"
| |
− | $ export TENCENTCLOUD_SECRET_KEY="your_fancy_accesskey"
| |
− | $ export TENCENTCLOUD_REGION="ap-hongkong"
| |
− | | |
− | 这样在 provider.tf 文件中就可以省略掉相关信息
| |
− | | |
− | $ vim provider.tf
| |
− |
| |
− | // provider.tf
| |
− | provider "tencentcloud" {}
| |
− | | |
− | | |
− | </pre>
| |
− | | |
− | https://cloud.tencent.com/developer/article/1473713
| |
− | | |
− | https://cloud.tencent.com/developer/article/1478955?from=article.detail.1473713 腾讯云Terraform应用指南(二
| |
− | | |
− | =see also=
| |
− | [https://help.aliyun.com/document_detail/145531.html?spm=a2c4g.11186623.6.573.13b13c3dRRN1oU Terraform常用命令] | |
− | | |
− | | |
− | =使用实例标识 image-id etc=
| |
− | [https://help.aliyun.com/document_detail/67254.html 使用实例标识]
| |
− | | |
− | [https://help.aliyun.com/document_detail/48749.html 通过示例模板创建资源栈]
| |
− | | |
− | [https://help.aliyun.com/document_detail/66902.html 如何为ECS资源指定镜像]
| |