Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

suzuki-shunsuke/ansible-gvm-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-gvm-module

Build Status

ansible module to run gvm command.

https://galaxy.ansible.com/suzuki-shunsuke/gvm-module/

Notice

Supported platform

  • GenericLinux
  • MacOSX

We test this module in

  • Ubuntu 16.04 (Vagrant, Virtualbox)
  • CentOS 7.3 (Vagrant, Virtualbox)
  • MaxOS Sierra 10.12.5

Requirements

If you want to install gvm and golang build dependencies with ansible role, we recommend the suzuki-shunsuke.gvm.

Supported gvm subcommands 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>

Install

$ ansible-galaxy install suzuki-shunsuke.gvm-module
# playbook.yml

- hosts: default
  roles:
  # After you call this role, you can use this module.
  - suzuki-shunsuke.gvm-module

Options

Common Options

name type required default choices / example description
subcommand str no install [install, uninstall, list, listall, alias list, alias create, alias delete]
gvm_root str no ~/.gvm If the environment variable "GVM_ROOT" is not set, this option is required
expanduser bool no yes By default the environment variable GVM_ROOT and "gvm_root" option are filtered by os.path.expanduser

Options of the "install" subcommand

parameter type required default choices / example description
version str yes go1.4
binary bool no no If you want to avoid compile errors, we recommend to set this option to "yes"
prefer_binary bool no no
with_build_tools bool no no
with_protobuf bool no no

Options of the "uninstall" subcommand

parameter type required default choices / example description
version str yes go1.4

Options of the "list" subcommand

Nothing.

The return value of the "list" subcommand has "versions" field.

Options of the "listall" subcommand

Nothing.

The return value of the "listall" subcommand has "versions" field.

Options of the "alias list" subcommand

Nothing.

The return value of the "alias list" subcommand has "aliases" field.

Options of the "alias create" subcommand

parameter type required default choices / example description
version str yes go1.4
alias str yes foo

Options of the "alias delete" subcommand

parameter type required default choices / example description
alias str yes foo

Example

- name: gvm install go1.4
  gvm:
    version: go1.4
    gvm_root: "~/.gvm"

- name: gvm install go1.5 --binary
  gvm:
    version: go1.5
    gvm_root: "~/.gvm"
    binary: yes

- name: gvm uninstall go1.5
  gvm:
    subcommand: uninstall
    version: go1.5
    gvm_root: "~/.gvm"

- name: gvm list
  gvm:
    subcommand: list
    gvm_root: "~/.gvm"
  register: result
- debug:
    var: result.versions

- name: gvm listall
  gvm:
    subcommand: listall
    gvm_root: "~/.gvm"
  register: result
- debug:
    var: result.versions

- name: gvm alias create foo go1.4
  gvm:
    subcommand: alias create
    version: go1.4
    alias: foo
    gvm_root: "~/.gvm"

- name: gvm alias list
  gvm:
    subcommand: alias list
    gvm_root: "~/.gvm"
  register: result
- debug:
    var: result.aliases

- name: gvm alias delete foo
  gvm:
    subcommand: alias delete
    alias: foo
    gvm_root: "~/.gvm"

Change Log

See CHANGELOG.md.

See also

Licence

MIT

Develop

Requirements

  • Vagrant
  • Ansible
  • Node.js
  • yarn

Setup

$ yarn install
$ cd tests
$ ansible-galaxy install -r roles.yml

Test

$ cd tests
$ vagrant up --provision