mr-pmillz/ansible-role-golang
Ansible role for installing the Go language SDK
Ansible Role: Go language SDK
Role to download and install the Go language SDK.
Requirements
-
Ansible Core >= 2.17
-
Linux Distribution
-
Debian Family
-
Debian
- Bullseye (11)
- Bookworm (12)
-
Ubuntu
- Jammy (22.04)
- Noble (24.04)
-
-
RedHat Family
-
Rocky Linux
- 9
-
Fedora
- 41
-
-
SUSE Family
-
openSUSE
- Tumbleweed
-
-
Note: other versions are likely to work but have not been tested.
-
Role Variables
The following variables will change the behavior of this role (default values
are shown below):
# Go language SDK version number
golang_version: '1.26.0'
# Mirror to download the Go language SDK redistributable package from
golang_mirror: 'https://dl.google.com/go'
# Base installation directory the Go language SDK distribution
golang_install_dir: '/opt/go/{{ golang_version }}'
# Directory to store files downloaded for Go language SDK installation
golang_download_dir: "{{ x_ansible_download_dir | default(ansible_facts.env.HOME + '/.ansible/tmp/downloads') }}"
# Location for GOPATH environment variable
golang_gopath:Supported Go language SDK Versions
The following versions of Go language SDK are supported without any additional
configuration (for other versions follow the Advanced Configuration
instructions):
1.26.01.25.71.25.61.25.51.25.41.25.31.25.21.25.11.25.01.24.131.24.121.24.111.24.101.24.91.24.81.24.71.24.61.24.51.24.41.24.31.24.21.24.11.24.01.23.121.23.111.23.101.23.91.23.81.23.71.23.61.23.51.23.41.23.31.23.21.23.11.23.01.22.111.22.101.22.91.22.81.22.71.22.61.22.51.22.41.22.31.22.21.22.11.22.01.21.131.21.121.21.111.21.101.21.91.21.81.21.71.21.61.21.51.21.41.21.31.21.21.21.11.21.01.20.131.20.121.20.111.20.101.20.91.20.81.20.71.20.61.20.51.20.41.20.31.20.21.20.11.201.19.121.19.111.19.101.19.91.19.81.19.71.19.61.19.51.19.41.19.31.19.21.19.11.191.18.101.18.91.18.81.18.71.18.61.18.51.18.41.18.31.18.21.18.11.181.17.131.17.121.17.111.17.101.17.91.17.81.17.71.17.61.17.51.17.41.17.31.17.21.17.11.171.16.151.16.141.16.131.16.121.16.111.16.101.16.91.16.81.16.71.16.61.16.51.16.41.16.31.16.21.16.11.161.15.151.15.141.15.131.15.121.15.111.15.101.15.91.15.81.15.71.15.61.15.51.15.41.15.31.15.21.15.11.151.14.151.14.141.14.131.14.121.14.111.14.101.14.91.14.81.14.71.14.61.14.51.14.41.14.31.14.21.14.11.141.13.151.13.141.13.131.13.121.13.111.13.101.13.91.13.81.13.71.13.61.13.51.13.41.13.31.13.21.13.11.131.12.171.12.161.12.151.12.141.12.131.12.121.12.111.12.101.12.91.12.81.12.71.12.61.12.51.12.41.12.31.12.21.12.11.121.11.131.11.121.11.111.11.101.11.91.11.81.11.71.11.61.11.51.11.41.11.31.11.21.11.11.111.10.81.10.71.10.61.10.51.10.41.10.31.10.21.10.11.101.9.71.9.61.9.51.9.41.9.31.9.21.9.11.91.8.71.8.61.8.51.8.41.8.31.8.21.8.11.81.7.41.7.3
Advanced Configuration
The following role variable is dependent on the Go language SDK version; to use
a Go language SDK version not pre-configured by this role you must configure
the variable below:
# SHA256 sum for the redistributable package (i.e. "go{{ golang_version }}.linux-amd64.tar.gz")
golang_redis_sha256sum: '6e3e9c949ab4695a204f74038717aa7b2689b1be94875899ac1b3fe42800ff82'Example Playbook
- hosts: servers
roles:
- role: gantsign.golang
golang_gopath: '$HOME/workspace-go'Role Facts
This role exports the following Ansible facts for use by other roles:
-
ansible_local.golang.general.version- e.g.
1.7.3
- e.g.
-
ansible_local.golang.general.home- e.g.
/opt/golang/1.7.3
- e.g.
More Roles From GantSign
You can find more roles from GantSign on
Ansible Galaxy.
Development & Testing
This project uses the following tooling:
- Molecule for orchestrating test scenarios
- Testinfra for testing the changes on the
remote - pytest the testing framework
- Tox manages Python virtual
environments for linting and testing - pip-tools for managing dependencies
A Visual Studio Code
Dev Container is
provided for developing and testing this role.
License
MIT
Author Information
John Freeman
GantSign Ltd.
Company No. 06109112 (registered in England)