go
Ansible Role: go
Role to install (by default) go programming language on Debian/Ubuntu and EL systems.
Requirements
None.
Role Variables
Available variables are listed below (located in defaults/main.yml
):
Variables list:
go_app: go
go_setup: true
go_version: 1.22.4
go_os: "{{ ansible_system | lower }}"
go_architecture_map:
amd64: amd64
arm: arm64
x86_64: amd64
armv6l: armv6
armv7l: armv7
aarch64: arm64
32-bit: "386"
64-bit: amd64
go_dl_url: "https://dl.google.com/{{ go_app }}/{{ go_app }}{{ go_version }}.{{ go_os }}-{{ go_architecture_map[ansible_architecture] }}.tar.gz"
go_bin_path: /usr/local
go_profile_template_export_line: "{{ go_bin_path}}/go/bin"
go_profile_template_path: /etc/profile.d
go_profile_template_source_file: go.j2
go_profile_template_dest_file: go.sh
Variables table:
Variable | Description |
---|---|
go_app | Defines the app to install i.e. go |
go_setup | Boolean variable that only allows true or false values. Defaults to true . When set to true it will setup/install go. When set to false , it will remove go from the system - assuming it was installed via this role and value for go_bin_path path is correct. |
go_version | Defined to dynamically fetch the desired version to install. Defaults to: 1.22.4 |
go_os | Defines OS type. Used for obtaining the correct type of binaries based on OS. |
go_architecture_map | Defines Architecture type. Used for obtaining the correct type of binaries based on Architecture. |
go_dl_url | Defines URL to download the go binary from. |
go_bin_path | Defined to dynamically set the appropriate path to store go binary into. Defaults to: /usr/local - which is sourced using a handler. |
go_profile_template_export_line | Defined to set the line for export to path within a custom file generated into /etc/profile.d directory. |
go_profile_template_path | Directory in which to generate go's PATH export template to. |
go_profile_template_source_file | Source template file for export of go's binary into PATH. |
go_profile_template_dest_file | Destination filename that will be placed in /etc/profile.d with go's PATH export as. |
Dependencies
None
Example Playbook
For default behaviour of role (i.e. installation of go) in ansible playbooks.
- hosts: servers
roles:
- darkwizard242.go
For customizing behavior of role (i.e. specifying the desired go version) in ansible playbooks.
- hosts: servers
roles:
- darkwizard242.go
vars:
go_version: 1.14.0
go_setup: true
For customizing behavior of role (i.e. placing binary of go package in different location) in ansible playbooks.
- hosts: servers
roles:
- darkwizard242.go
vars:
go_bin_path: /bin/
License
Author Information
This role was created by Ali Muhammad.
About
Installs/Uninstalls 'go' - programming language and sets up system-wide export.
Install
ansible-galaxy install darkwizard242/ansible-role-go
License
mit
Downloads
10479
Owner
Senior DevOps/CloudOps Engineer.
Dedicated to Automating everything I come across.
Love to work on and learn new technologies/tools everyday!