fubarhouse.golang

Ansible 角色: Go
- 安装 Google 的 Go 编程语言
- 安装配置完全自动化
- 安装配置可以手动设置
- 从可配置的镜像安装
- 可选择在需要时清理你的
$GOPATH
- 使用
go get
和/或go install
安装可选包
要求
无要求。
角色变量
安装配置
go_custom_mirror: https://storage.googleapis.com/golang
基本配置
go_version: 1.10beta2
GOPATH: /home/vagrant/go
GOROOT: /usr/local/go
GOPROXY: https://proxy.golang.org
可选配置
GO111MODULE: "on" # 需要字符串类型,而非开/关,将按布尔值处理
GOOS: darwin
GOARCH: amd64
go_checksum: sha256:82628a1a42d7ad88b100d0c4c9c0282a7e008e4eb73876bed4bd61ac4ee11b46
从源代码构建
Golang 引导工作区
GOROOT_BOOTSTRAP: /home/vagrant/go1.4
布尔值,指示是否应从源代码构建。
build_go_from_source: false
布尔值,指示引导需要安装。
install_go_bootstrap: false
构建时应使用的脚本
go_build_script: make.bash
要安装 go get
二进制文件/项目,将它们添加到 go_get
,并按需求配置任何模块。未指定 modules
的值时,安装将采用 GO111MODULE
的值。
默认配置没有模块配置:
go_get:
- name: golint
url: github.com/golang/lint/golint
禁用模块的配置:
go_get:
- name: dvm
url: github.com/fubarhouse/dvm
modules: false
启用模块的配置:
go_get:
- name: gopm
url: github.com/gpmgo/gopm
modules: true
你还可以手动克隆并获取特定版本的包,这不包括任何依赖项的下载。
这是出于需要安装用 Go 编写的软件的特定版本,当前语言没有提供其他替代方案。
强烈建议你多次运行此 playbook,直到成功,并与此功能一起使用 go_reget
,或者在绝对必要时再使用此功能。
go_install:
# repo 是 git 克隆的 URL, ssh 或 https.
- repo: https://github.com/fubarhouse/dvm.git
# dest 是命名空间
dest: github.com/fubarhouse/dvm
# version 是指标签或分支。
version: 2.2.5
package: github.com/fubarhouse/dvm
为确保在运行 play 之前删除所有包,可以使用 go_reget 变量:
go_reget: true
要添加/更改要配置的 shell 配置文件的绝对路径,请使用 golang_shell_profile
。
如果不定义 golang_shell_profile
,则该功能将被忽略。
golang_shell_profile: /root/.bash_profile
在角色执行之前完全清理安装:
go_install_clean: true
防止清理操作删除 GOPATH
go_install_clean_full: false
设置权限
注意: 如果指定的权限不足,playbook 将把后续操作视为新安装,因为无法确定已安装的版本。 要指定代码库的权限,可以设置:
mode_codebase: 0755
要指定工作区的权限,可以设置:
mode_workspace: 0755
依赖关系
无依赖关系。
示例 Playbook
- hosts: localhost
roles:
- fubarhouse.golang
安装
- 使用
ansible-galaxy install fubarhouse.golang
安装 - 将此角色添加到你的 playbook 中。
- 根据需要修改上述变量。
许可证
MIT / BSD
作者信息
此角色由 Karl Hepworth 于 2016 年创建。
Go 的吉祥物图片由 Takuya Ueda 创建。根据创意共享 3.0 署名许可证授权。该图片经过缩放处理,但其他方面保持不变。
关于项目
Installs the Go programming language from distribution, or build from source, and install desired packages to your Golang workspace!
安装
ansible-galaxy install fubarhouse.golang
许可证
mit
下载
38.8k
拥有者
Lover of all things open source and computers - both hardware and software. My opinions are my own.