Rename install-go to ensure-go for consistency
The old role will be kept and include ensure-go for backwards-compatability. Change-Id: I4e6345563817057a6c47c124b9ec8b0c62b057d6
This commit is contained in:
parent
483ea85f63
commit
6dabffe402
@ -1,6 +1,7 @@
|
||||
Go Roles
|
||||
========
|
||||
|
||||
.. zuul:autorole:: ensure-go
|
||||
.. zuul:autorole:: ensure-golangci-lint
|
||||
.. zuul:autorole:: install-go
|
||||
.. zuul:autorole:: go
|
||||
|
@ -1,3 +1,3 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- install-go
|
||||
- ensure-go
|
||||
|
17
roles/ensure-go/README.rst
Normal file
17
roles/ensure-go/README.rst
Normal file
@ -0,0 +1,17 @@
|
||||
Install go
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: go_install_dir
|
||||
:default: /usr/local/
|
||||
|
||||
Directory to install go in.
|
||||
|
||||
.. zuul:rolevar:: go_version
|
||||
:default: 1.13
|
||||
|
||||
.. zuul:rolevar:: go_os
|
||||
:default: {{ ansible_system | lower }}
|
||||
|
||||
.. zuul:rolevar:: go_arch
|
||||
:default: amd64 / 386
|
14
roles/ensure-go/tasks/main.yaml
Normal file
14
roles/ensure-go/tasks/main.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
- name: Check installed go version
|
||||
command: go version
|
||||
register: go_installed_version
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Skip if correct version of go is installed
|
||||
include_tasks: install-go.yaml
|
||||
when:
|
||||
- go_installed_version.rc != 0 or
|
||||
go_version != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<version>')) or
|
||||
go_os != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<os>')) or
|
||||
go_arch != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<arch>'))
|
@ -1,17 +1 @@
|
||||
Install go
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: go_install_dir
|
||||
:default: /usr/local/
|
||||
|
||||
Directory to install go in.
|
||||
|
||||
.. zuul:rolevar:: go_version
|
||||
:default: 1.13
|
||||
|
||||
.. zuul:rolevar:: go_os
|
||||
:default: {{ ansible_system | lower }}
|
||||
|
||||
.. zuul:rolevar:: go_arch
|
||||
:default: amd64 / 386
|
||||
.. warning:: Deprecated, use ensure-go instead.
|
||||
|
@ -1,14 +1,3 @@
|
||||
- name: Check installed go version
|
||||
command: go version
|
||||
register: go_installed_version
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Skip if correct version of go is installed
|
||||
include_tasks: install-go.yaml
|
||||
when:
|
||||
- go_installed_version.rc != 0 or
|
||||
go_version != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<version>')) or
|
||||
go_os != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<os>')) or
|
||||
go_arch != (go_installed_version.stdout|regex_replace(go_version_pattern, '\\g<arch>'))
|
||||
- name: Include ensure-go
|
||||
include_role:
|
||||
name: ensure-go
|
||||
|
Loading…
Reference in New Issue
Block a user