Giter VIP home page Giter VIP logo

ansible-role-golang's Introduction

Ansible Role: Go

Build Status stability-stable Ansible Galaxy MIT licensed

  • Installs the Google Go programming language
  • Install configurations are entirely automatic
  • Install configurations can be manually set
  • Installs from configurable mirror
  • Optionally cleans your $GOPATH whenever you need to.
  • Installs optional packages using go get and/or go install.

Requirements

None.

Role Variables

Installation configuration

go_custom_mirror: https://storage.googleapis.com/golang

Basic configuration

go_version: 1.10beta2
GOPATH: /home/vagrant/go
GOROOT: /usr/local/go
GOPROXY: https://proxy.golang.org

Optional configuration

GO111MODULE: "on" # Needs to be of type string, not on/off which will be handled as a boolean.
GOOS: darwin
GOARCH: amd64
go_checksum: sha256:82628a1a42d7ad88b100d0c4c9c0282a7e008e4eb73876bed4bd61ac4ee11b46

Building from source

Golang Bootstrap Workspace

GOROOT_BOOTSTRAP: /home/vagrant/go1.4

Boolean to indicate build should be from source.

build_go_from_source: false

Boolean to indicate Bootstrap needs installation.

install_go_bootstrap: false

Which script should be used when building from source

go_build_script: make.bash

To install go get binaries/projects, add them to go_get

go_get:
- name: gopm
  url: github.com/gpmgo/gopm
- name: golint
  url: github.com/golang/lint/golint

You can also manually clone and get specific versions of packages, which does not include the download of any dependencies.

This was due to the need to install specific versions of software written in Go, and the language provides no alternative at this time.

It's highly recommend you run this playbook as many times as you need until you can get a success and to use go_reget in conjunction with this feature, or to not use this feature unless absolutely necessary.

go_install:
  # repo is the git clone url, ssh or https.
- repo: https://github.com/fubarhouse/dvm.git
  # dest is the namespace
  dest: github.com/fubarhouse/dvm
  # version refers to a tag, or branch.
  version: 2.2.5
  package: github.com/fubarhouse/dvm

To ensure all packages are removed before running the play, you can use the go_reget variable:

go_reget: true

To add/change the absolute path of shell profiles to configure, use golang_shell_profile.

If you do not define golang_shell_profile, the functionality will be ignored.

golang_shell_profile: /root/.bash_profile

To clean up an installation completely prior to role execution:

go_install_clean: true

Setting permissions

Note: If you specify insufficient permissions the playbook will treat the following play as a new installation because it will not be able to determine what version is installed. To specify the permissions of the codebase, you can set:

mode_codebase: 0755

To specify the permissions of the workspace, you can set:

mode_workspace: 0755

Dependencies

None.

Example Playbook

- hosts: localhost
  roles:
    - fubarhouse.golang

Installation

  • Install using ansible-galaxy install fubarhouse.golang
  • Add this role to your playbook.
  • Modify above variables as desired.

License

MIT / BSD

Author Information

This role was created in 2016 by Karl Hepworth.

Image of Go's mascot was created by Takuya Ueda. Licenced under the Creative Commons 3.0 Attributions license. This image has been resized for purpose, but is otherwise unchanged.

ansible-role-golang's People

Contributors

dmitryromanov avatar fubarhouse avatar ioncebotari avatar isakrubin avatar liemle3893 avatar mpppk avatar saboteurkid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.