From b24d17852b6055ebcaeef89ce38556fdae053a1c Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 9 Sep 2019 15:46:24 +0300 Subject: [PATCH] Update ansible script for generating packages to verify if the version of go is current and is /usr/bin/python exist --- data/ansible/packages/go.yaml | 12 ++++++++++++ data/ansible/packages/main.yaml | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/ansible/packages/go.yaml b/data/ansible/packages/go.yaml index 042f54f6b..a5fa43b3f 100644 --- a/data/ansible/packages/go.yaml +++ b/data/ansible/packages/go.yaml @@ -11,6 +11,18 @@ mode: 'u=rwx,go=rx' dest: '{{ golang_download_dir }}' +- name: Register the current Go version (if any) + command: /usr/local/go/bin/go version + ignore_errors: yes + register: go_version + changed_when: false + +- name: Remove old installation of Go + file: + path: /usr/local/go + state: absent + when: go_version is failed or go_version.stdout != go_version_target + - name: download Go language SDK get_url: url: '{{ golang_mirror }}/{{ golang_redis_filename }}' diff --git a/data/ansible/packages/main.yaml b/data/ansible/packages/main.yaml index cf0c6319a..1fc737e09 100644 --- a/data/ansible/packages/main.yaml +++ b/data/ansible/packages/main.yaml @@ -1,4 +1,16 @@ --- +- name: symlink /usr/bin/python -> /usr/bin/python3 + hosts: all + remote_user: '{{ gouser }}' + gather_facts: false + tasks: + - name: symlink /usr/bin/python -> /usr/bin/python3 + raw: | + if [ -f /usr/bin/python3 ] && [ ! -f /usr/bin/python ]; then + ln --symbolic /usr/bin/python3 /usr/bin/python; + fi + become: true + - hosts: all vars: ############################################################### @@ -6,6 +18,7 @@ ############################################################### # Go language SDK version number golang_version: '1.13' + go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' # Base installation directory the Go language SDK distribution