-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from fubarhouse/issue-1
Issue 1
- Loading branch information
Showing
10 changed files
with
592 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
|
||
- name: "Generic | Find GOROOT" | ||
shell: "echo $GOROOT | grep go" | ||
register: echo_goroot | ||
failed_when: false | ||
|
||
- name: "Generic | Removing directories" | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- "{{ echo_goroot.stdout | default(go_location) }}" | ||
- "{{ go_location }}" | ||
failed_when: false | ||
|
||
|
||
- name: "Go-Lang | Define shell exports to cleanup" | ||
set_fact: | ||
shell_exports_static: | ||
- regex: "export GOROOT={{ go_location }}" | ||
lineinfile: "export GOROOT={{ go_location }}" | ||
- regex: "export GOPATH={{ go_location }}/bin" | ||
lineinfile: "export GOPATH={{ go_location }}/bin" | ||
- regex: export PATH=\$PATH:\$GOROOT/bin | ||
lineinfile: export PATH=$PATH:$GOROOT/bin | ||
when: shell_exports_static is undefined | ||
|
||
- name: "Go-Lang | Ensure shell profiles are clean" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
lineinfile: | ||
dest: "{{ fubarhouse_user_dir }}/{{ item[0] }}" | ||
regexp: "{{ item[1].regex }}" | ||
line: "{{ item[1].lineinfile }}" | ||
state: absent | ||
with_nested: | ||
- "{{ shell_profiles }}" | ||
- "{{ shell_exports_static }}" | ||
ignore_errors: yes | ||
when: shell_exports_static is defined | ||
|
||
- name: "GVM | Define shell exports to cleanup" | ||
set_fact: | ||
shell_exports_gvm: | ||
- regex: "export GOROOT={{ go_location }}" | ||
lineinfile: "export GOROOT={{ go_location }}" | ||
- regex: "export GOPATH={{ go_location }}/bin" | ||
lineinfile: "export GOPATH={{ go_location }}/bin" | ||
- regex: export PATH=\$PATH:\$GOROOT/bin | ||
lineinfile: export PATH=$PATH:$GOROOT/bin | ||
# - regex: "{{ GVM_DEST }}/scripts/gvm" | ||
# lineinfile: source "{{ GVM_DEST }}/scripts/gvm" | ||
when: shell_exports_gvm is undefined | ||
|
||
- name: "GVM | Ensure shell profiles are clean" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
lineinfile: | ||
dest: "{{ fubarhouse_user_dir }}/{{ item[0] }}" | ||
regexp: "{{ item[1].regex }}" | ||
line: "{{ item[1].lineinfile }}" | ||
state: absent | ||
with_nested: | ||
- "{{ shell_profiles }}" | ||
- "{{ shell_exports_gvm }}" | ||
ignore_errors: yes | ||
when: shell_exports_gvm is defined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
|
||
- name: "GoPM | Check folder permissions/state" | ||
become: yes | ||
become_user: "root" | ||
file: | ||
path: "{{ go_location }}/modules" | ||
state: directory | ||
mode: 0755 | ||
owner: "{{ fubarhouse_user }}" | ||
recurse: yes | ||
|
||
- name: "GoPM | Run get commands for installed version" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "{{ go_symlink }} get {{ item }}" | ||
environment: | ||
GOPATH: "{{ go_location }}/pkg" | ||
GOROOT: "{{ go_location }}/gos/go{{ go_version }}" | ||
with_items: "{{ go_get }}" | ||
when: go_version != 'master' and (go_install_type == 'gvm' or go_install_type == 'source') | ||
|
||
- name: "GoPM | Run get commands for installed source" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "{{ go_symlink }} get -dfu {{ item }}" | ||
environment: | ||
GOPATH: "{{ go_location }}/pkg" | ||
GOROOT: "{{ go_location }}/gos/{{ go_version }}" | ||
with_items: "{{ go_get }}" | ||
when: go_version == 'master' and (go_install_type == 'gvm' or go_install_type == 'source') | ||
|
||
- name: "GoPM | Run get commands for static install" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "go get -dfu {{ item }}" | ||
environment: | ||
GOPATH: "{{ go_location }}/pkg" | ||
GOROOT: "{{ go_location }}" | ||
with_items: "{{ go_get }}" | ||
when: go_install_type == 'static' | ||
|
||
- name: "GoPM | Link installed version" | ||
become: yes | ||
become_user: root | ||
file: | ||
src: "{{ GVM_DEST }}/gos/go{{ go_version }}/bin/gopm" | ||
dest: "{{ go_symlink }}pm" | ||
state: link | ||
mode: 0755 | ||
owner: "{{ fubarhouse_user }}" | ||
force: yes | ||
when: '"{{ go_version }}" != "master"' | ||
|
||
- name: "GoPM | Link source version" | ||
become: yes | ||
become_user: root | ||
file: | ||
src: "{{ GVM_DEST }}/gos/{{ go_version }}/bin/gopm" | ||
dest: "{{ go_symlink }}pm" | ||
state: link | ||
mode: 0755 | ||
owner: "{{ fubarhouse_user }}" | ||
force: yes | ||
when: '"{{ go_version }}" == "master"' | ||
|
||
- name: "GoPM | Install packages for installed version" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "{{ go_symlink }}pm install {{ item }}" | ||
with_items: "{{ gopm_packages }}" | ||
when: '"github.com/gpmgo/gopm" in "{{ go_get }}" and go_version != "master" and (go_install_type == "gvm" or go_install_type == "source")' | ||
|
||
- name: "GoPM | Install packages installed source" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "{{ go_symlink }}pm install {{ item }}" | ||
with_items: "{{ gopm_packages }}" | ||
when: '"github.com/gpmgo/gopm" in "{{ go_get }}" and go_version == "master" and (go_install_type == "gvm" or go_install_type == "source")' | ||
|
||
- name: "GoPM | Install packages for static installs" | ||
become: yes | ||
become_user: "{{ fubarhouse_user }}" | ||
shell: "{{ go_symlink }}pm install {{ item }}" | ||
with_items: "{{ gopm_packages }}" | ||
when: '"github.com/gpmgo/gopm" in "{{ go_get }}" and (go_install_type == "static")' |
Oops, something went wrong.