suzuki-shunsuke.gvm-module
ansible-gvm-module
This is an Ansible module for running GVM commands.
Find it here: https://galaxy.ansible.com/suzuki-shunsuke/gvm-module/
Important Notes
- This module does not work in check mode.
- GVM stands for Go Version Manager and is not related to Groovy enVironment Manager.
Supported Platforms
- Generic Linux
- macOS
We test this module on:
- Ubuntu 16.04 (using Vagrant and Virtualbox)
- CentOS 7.3 (using Vagrant and Virtualbox)
- macOS Sierra 10.12.5
Requirements
You need to have:
If you want to install gvm and its dependencies using Ansible, we recommend the suzuki-shunsuke.gvm role.
Supported GVM Commands and Options
$ gvm install <version> [--binary] [--prefer-binary] [--with-build-tools] [--with-protobuf]
$ gvm uninstall <version>
$ gvm list
$ gvm listall
$ gvm alias list
$ gvm alias create <alias> <version>
$ gvm alias delete <alias>
Installation
To install the module, run:
$ ansible-galaxy install suzuki-shunsuke.gvm-module
Example Ansible playbook (playbook.yml
):
- hosts: default
roles:
- suzuki-shunsuke.gvm-module # Use this module after calling the role.
Options
Common Options
Name | Type | Required | Default | Choices / Examples | Description |
---|---|---|---|---|---|
subcommand | str | no | install | [install, uninstall, list, listall, alias list, alias create, alias delete] | The command to execute. |
gvm_root | str | no | ~/.gvm | Required if "GVM_ROOT" environment variable is not set. | |
expanduser | bool | no | yes | Filters gvm_root with os.path.expanduser . |
Options for the "install" Command
Parameter | Type | Required | Default | Choices / Examples | Description |
---|---|---|---|---|---|
version | str | yes | go1.4 | The version of Go to install. | |
binary | bool | no | no | Set to "yes" to avoid compile errors. | |
prefer_binary | bool | no | no | ||
with_build_tools | bool | no | no | ||
with_protobuf | bool | no | no |
Options for the "uninstall" Command
Parameter | Type | Required | Default | Choices / Examples | Description |
---|---|---|---|---|---|
version | str | yes | go1.4 | The version of Go to uninstall. |
Options for the "list" Command
No parameters needed.
Returns a "versions" field.
Options for the "listall" Command
No parameters needed.
Returns a "versions" field.
Options for the "alias list" Command
No parameters needed.
Returns an "aliases" field.
Options for the "alias create" Command
Parameter | Type | Required | Default | Choices / Examples | Description |
---|---|---|---|---|---|
version | str | yes | go1.4 | The version to use for the alias. | |
alias | str | yes | foo | The name of the alias. |
Options for the "alias delete" Command
Parameter | Type | Required | Default | Choices / Examples | Description |
---|---|---|---|---|---|
alias | str | yes | foo | The name of the alias to delete. |
Example
- name: Install Go version 1.4 with gvm
gvm:
version: go1.4
gvm_root: "~/.gvm"
- name: Install Go version 1.5 with binary option
gvm:
version: go1.5
gvm_root: "~/.gvm"
binary: yes
- name: Uninstall Go version 1.5
gvm:
subcommand: uninstall
version: go1.5
gvm_root: "~/.gvm"
- name: List installed Go versions
gvm:
subcommand: list
gvm_root: "~/.gvm"
register: result
- debug:
var: result.versions
- name: List all Go versions
gvm:
subcommand: listall
gvm_root: "~/.gvm"
register: result
- debug:
var: result.versions
- name: Create alias 'foo' for Go version 1.4
gvm:
subcommand: alias create
version: go1.4
alias: foo
gvm_root: "~/.gvm"
- name: List all aliases
gvm:
subcommand: alias list
gvm_root: "~/.gvm"
register: result
- debug:
var: result.aliases
- name: Delete alias 'foo'
gvm:
subcommand: alias delete
alias: foo
gvm_root: "~/.gvm"
Change Log
Check CHANGELOG.md.
Additional Resources
- suzuki-shunsuke.gvm: Ansible role for installing gvm.
License
Development
Requirements
- Vagrant
- Ansible
- Node.js
- Yarn
Setup
To set up the development environment, run:
$ yarn install
$ cd tests
$ ansible-galaxy install -r roles.yml
Test
To run tests, execute:
$ cd tests
$ vagrant up --provision
Installa
ansible-galaxy install suzuki-shunsuke.gvm-module
Licenza
mit
Download
517
Proprietario
Platform Engineer / OSS Developer / Go