Setup Go with ansible for Golang programming

Intro

Are you struggling how to install Go ? Setting $GOPATH , $GOTROOT, … ?

Are you familiar with Ansible ?

Then, this article is for you.

BONUS

IF you are not familiar with Ansible, you can master Ansible in 2 hours by watching this course: https://www.udemy.com/course/ansible-hero/

Bias for action

  1. Install the role :
ansible-galaxy install abdennour.golang

2. Write a playbook that imports the role :

- hosts: localhost # if you want to target another host, change it
tasks:
- import_role:
name: abdennour.golang
become: yes
vars:
golang_version: "1.14"
golang_packages:
- github.com/gorilla/mux
- go.mongodb.org/mongo-driver/mongo
golang_users:
- "YOUR_USERNAME" # "{{ ansible_ssh_user}}" might be suitable

3. Run it :

ansible-playbook ./yourfile_above.yaml

You did it !! Done ! Done ! Done

4. Validate

go version

Reliability

We are happy to release this role with a full end-to-end tests using molecule:

--

--

--

Software engineer, Cloud Architect, 5/5 AWS|GCP|PSM Certified, Owner of kubernetes.tn

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Totem DAO — The EYE👁‍🗨

End of Life for Universal Analytics is July 2023 — It’s Time to Migrate to GA4!

Create a dotnet core API boilerplate template with most popular open source libraries

Generics in Dart — Part I

“Experience creating a high level architecture and how it helps to see an overall picture of the…

Software Developers: Adapt or You’ll Be Replaced

Silhouetee of man on a plane.

Agora Cloud Recording QuickStart guide with Postman demo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdennour Toumi

Abdennour Toumi

Software engineer, Cloud Architect, 5/5 AWS|GCP|PSM Certified, Owner of kubernetes.tn

More from Medium

Go Pipeline for a layman

GoReleaser 1.5 — the misc improvements release

Reading Configuration Files in Go

The Go Programming Language