From cad0fd6ce5e56b5b667b8a4a309ab5f9a07faf1a Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 18 Sep 2017 21:30:46 +1000 Subject: [PATCH] Audit shell exports; Adjust logic for task inclusion; Fix up logic for MacOS; Change goroot and gopath. Signed-off-by: Karl Hepworth --- tasks/cleanup.yml | 16 ++++++++-------- tasks/install.yml | 24 ++++++++++++------------ tasks/main.yml | 8 +++++++- tasks/tasks-Darwin.yml | 2 +- tests/test.yml | 6 +++--- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index f1efc92..5b72f38 100755 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -18,14 +18,14 @@ - name: "Go-Lang | Define shell exports" set_fact: shell_exports: - - regex: "export GOROOT" - lineinfile: "export GOROOT={{ GOROOT }}" - - regex: "export GOPATH" - lineinfile: "export GOPATH={{ GOPATH }}" - - regex: "PATH:{{ GOPATH }}" - lineinfile: "export PATH=$PATH:{{ GOPATH }}" - - regex: "PATH:{{ GOPATH }}/bin" - lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin" + - regex: "export GOROOT" + lineinfile: "export GOROOT={{ GOROOT }}" + - regex: "export GOPATH" + lineinfile: "export GOPATH={{ GOPATH }}" + - regex: "PATH:{{ GOPATH }}" + lineinfile: "export PATH=$PATH:{{ GOPATH }}" + - regex: "PATH:{{ GOPATH }}/bin" + lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin" when: shell_exports is not defined - name: "Go-Lang | Detect configured shell profiles" diff --git a/tasks/install.yml b/tasks/install.yml index 56ef8e2..0b0c8f8 100755 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -2,14 +2,14 @@ - name: "Go-Lang | Define shell exports" set_fact: shell_exports: - - regex: "export GOROOT" - lineinfile: "export GOROOT={{ GOROOT }}" - - regex: "export GOPATH" - lineinfile: "export GOPATH={{ GOPATH }}" - - regex: "PATH:{{ GOPATH }}" - lineinfile: "export PATH=$PATH:{{ GOPATH }}" - - regex: "PATH:{{ GOPATH }}/bin" - lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin" + - regex: "export GOROOT" + lineinfile: "export GOROOT={{ GOROOT }}" + - regex: "export GOPATH" + lineinfile: "export GOPATH={{ GOPATH }}" + - regex: "PATH:{{ GOROOT }}/bin" + lineinfile: "export PATH=$PATH:{{ GOROOT }}/bin" + - regex: "PATH:{{ GOPATH }}/bin" + lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin" when: shell_exports is not defined - name: "Go-Lang | Include bootstrap tasks" @@ -18,19 +18,19 @@ - install_go_bootstrap|bool == true - go_binary_bootstrap.stat.exists|bool == false - GOROOT_BOOTSTRAP is defined - - 'go_version_string not in current_go_version' + - expected_go_version_output|string not in current_go_version.stdout|default('') - name: "Go-Lang | Include source build tasks" include: install-git.yml when: - build_go_from_source|bool == true - - 'go_version_string not in current_go_version' + - expected_go_version_output|string not in current_go_version.stdout|default('') - name: "Go-Lang | Include distro install tasks" include: install-distro.yml when: - build_go_from_source|bool == false - - 'go_version_string not in current_go_version' + - expected_go_version_output|string not in current_go_version.stdout|default('') - name: "Go-Lang | Detect configured shell profiles" stat: @@ -63,7 +63,7 @@ GOROOT: "{{ GOROOT }}" GOPATH: "{{ GOPATH }}" register: go_version_output - failed_when: 'go_version_string not in go_version_output.stdout' + failed_when: go_version_string not in go_version_output.stdout changed_when: false - name: "Go-Lang | Restart shell" diff --git a/tasks/main.yml b/tasks/main.yml index fc746eb..c28a91e 100755 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -22,4 +22,10 @@ when: go_install.0 is defined - name: "Include tasks for setting Go permissions" - include: perm.yml \ No newline at end of file + include: perm.yml + +- debug: + msg: "{{ expected_go_version_output }}" + +- debug: + msg: "{{ current_go_version.stdout }}" \ No newline at end of file diff --git a/tasks/tasks-Darwin.yml b/tasks/tasks-Darwin.yml index c7a8d55..26e2cea 100644 --- a/tasks/tasks-Darwin.yml +++ b/tasks/tasks-Darwin.yml @@ -2,7 +2,7 @@ - name: "Go-Lang | Define GOARCH" set_fact: - GOARCH: "arm64" + GOARCH: "amd64" when: GOARCH is not defined - name: "Go-Lang | Define GOOS" diff --git a/tests/test.yml b/tests/test.yml index 246454d..92bf9d5 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -8,9 +8,9 @@ build_go_from_source: true install_go_bootstrap: true go_temporary_dir: /home/travis/temp - GOROOT: /home/travis/go_travis_test - GOPATH: /home/travis/go_path - GOROOT_BOOTSTRAP: /home/travis/go_travis_test_go1.4 + GOROOT: /home/travis/goroot1.9 + GOPATH: /home/travis/gopath + GOROOT_BOOTSTRAP: /home/travis/goroot1.4 pre_tasks: - file: