diff --git a/README.md b/README.md index 9bd8a8a..5d79067 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,12 @@ To ensure all packages are removed before running the play, you can use the go_r go_reget: true ```` -To add/change the shell profiles to configure, use the `shell_profiles` array. +To add/change the absolute path of shell profiles to configure, use `golang_shell_profile`. + +**If you do not define `golang_shell_profile`, the functionality will be ignored.** + ````yaml -shell_profiles: -- .bash_profile +golang_shell_profile: /root/.bash_profile ```` To clean up an installation completely prior to role execution: diff --git a/defaults/main.yml b/defaults/main.yml index 6f0f165..33aa939 100755 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -22,7 +22,3 @@ go_get: - name: golint url: github.com/golang/lint/golint go_install: [] - -# Configuration -shell_profiles: -- .bash_profile diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index 71abcdc..4b5f897 100755 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -23,14 +23,13 @@ - name: "Go-Lang | Ensure shell profiles are clean" lineinfile: - dest: "{{ item[0].stat.path }}" + dest: "{{ item[0] }}" regexp: "{{ item[1].regex }}" line: "{{ item[1].lineinfile }}" state: absent with_nested: - - "{{ stat_shell_profiles.results }}" + - "{{ golang_shell_profile }}" - "{{ shell_exports }}" when: - - shell_profiles is defined + - golang_shell_profile is defined - shell_exports is defined - - item[0].stat.exists|bool == true diff --git a/tasks/install.yml b/tasks/install.yml index 2610b6c..cb82184 100755 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -25,17 +25,15 @@ - name: "Go-Lang | Ensure shell profiles are configured" lineinfile: - dest: "{{ item[0].stat.path }}" + dest: "{{ item[0] }}" regexp: "{{ item[1].regex }}" line: "{{ item[1].lineinfile }}" state: present with_nested: - - "{{ stat_shell_profiles.results }}" + - "{{ golang_shell_profile }}" - "{{ shell_exports }}" when: - - stat_shell_profiles is defined - - shell_profiles is defined - - item[0].stat.exists|bool == true + - golang_shell_profile is defined - name: "Go-Lang | Verify version" shell: "{{ GOROOT }}/bin/go version" @@ -49,6 +47,5 @@ changed_when: false - name: "Go-Lang | Restart shell" - shell: "{{ fubarhouse_user_dir }}/{{ item }}" - with_items: "{{ shell_profiles }}" + shell: "{{ golang_shell_profile }}" failed_when: false diff --git a/tasks/setup.yml b/tasks/setup.yml index 6b0299d..105e732 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -55,17 +55,6 @@ - GOROOT is defined - GOPATH is not defined -- name: "Go-Lang | Detect configured shell profiles" - stat: - path: "{{ fubarhouse_user_dir }}/{{ item }}" - changed_when: false - failed_when: false - with_items: "{{ shell_profiles }}" - register: stat_shell_profiles - when: - - shell_profiles is defined - - stat_shell_profiles is not defined - - name: "Go-Lang | Define shell exports" set_fact: shell_exports: @@ -78,7 +67,7 @@ - regex: "PATH:{{ GOPATH }}/bin" lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin" when: - - stat_shell_profiles is defined + - golang_shell_profile is defined - shell_exports is not defined - name: "Go-Lang | Define GOROOT_BOOTSTRAP" diff --git a/tests/test.retry b/tests/test.retry new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/test.retry @@ -0,0 +1 @@ +localhost