abdennour.golang

abdennnour.golang

This role is for installing Go (Golang) along with setting up GOPATH and GOROOT.

Installation

You can install it using Ansible Galaxy:

ansible-galaxy install abdennour.golang

Requirements

None

Role Variables

You can customize the following variables:

Variable Description Default Value
golang_version The version of Go to install 1.14
golang_gopath The directory path for the GOPATH environment variable /opt/gopath
golang_install_dir The directory where Go will be installed /usr/local/share
golang_tarball_repo The repository URL to download Go https://golang.org/dl
golang_packages A list of Go packages to install (see example below) Example: ["github.com/gorilla/mux"]
golang_users A list of users to add to the Go group (see example) Example: ["ec2-user"]
golang_group The system group that owns Go files go

Role Facts

This role provides a variable called golang_fact_env, which is useful if your host doesn't recognize the go command after installing.

You can set this variable as the environment for the task:

# Import the role 
# Then,
- name: Use go command
  command: go get github.com/go-redis/redis
  environment: "{{ golang_fact_env }}"

Dependencies

None

Example Playbook

Here’s an example of how to use this role in a playbook:

- hosts: all
  tasks:
  - import_role:
      name: abdennour.golang
    vars:
      golang_version: "1.14"
      golang_packages:
      - github.com/gorilla/mux
      - go.mongodb.org/mongo-driver/mongo
      golang_users:
      - "{{ ansible_ssh_user }}"
    become: yes

License

This role is licensed under BSD.

Informazioni sul progetto

Setup Golang for Go programming. Can add also Go packages

Installa
ansible-galaxy install abdennour.golang
Licenza
Unknown
Download
1.5k
Proprietario
Former full stack developer, switched to the dark-side of DevOps!