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:
vass 2020-04-01 19:48:17 +02:00
parent 483ea85f63
commit 6dabffe402
9 changed files with 37 additions and 32 deletions

View File

@ -1,6 +1,7 @@
Go Roles
========
.. zuul:autorole:: ensure-go
.. zuul:autorole:: ensure-golangci-lint
.. zuul:autorole:: install-go
.. zuul:autorole:: go

View File

@ -1,3 +1,3 @@
- hosts: all
roles:
- install-go
- ensure-go

View 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

View 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>'))

View File

@ -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.

View File

@ -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