Last active
May 6, 2016 12:34
-
-
Save nomasprime/bc10eff328345378448f671dc8cbaae2 to your computer and use it in GitHub Desktop.
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
--- | |
- name: goenv checkout repo | |
git: | |
dest: "{{ ansible_env.HOME }}/.goenv" | |
repo: "https://github.com/syndbg/goenv.git" | |
- name: goenv update profile | |
lineinfile: | |
create: yes | |
dest: "{{ ansible_env.HOME }}/.bash_profile" | |
line: "{{ item.line }}" | |
regexp: "{{ item.regexp }}" | |
with_items: | |
- { line: 'export GOENV_ROOT="$HOME/.goenv"', regexp: '^export GOENV_ROOT="\$HOME/\.goenv"' } | |
- { line: 'export PATH="$GOENV_ROOT/bin:$PATH"', regexp: '^export PATH="\$GOENV_ROOT/bin:\$PATH"' } | |
- { line: eval "$(goenv init -)", regexp: 'eval "\$\(goenv init -\)"' } | |
- block: | |
- name: golang installed versions | |
command: goenv versions | |
ignore_errors: yes | |
register: golang_installed_versions | |
- name: golang install versions | |
command: goenv install {{ item.key }} | |
when: | |
(golang.versions is defined) and | |
(golang_installed_versions.stdout.find(item.key) == -1) | |
with_dict: "{{ golang.versions }}" | |
- name: golang global version | |
command: goenv global {{ golang.global_version }} | |
when: | |
(golang.global_version is defined) and | |
(golang_installed_versions.stdout.find('* ' + golang.global_version) == -1) | |
- name: golang local versions | |
command: goenv local {{ item.0 }} chdir={{ item.1 }} | |
ignore_errors: yes | |
with_subelements: | |
- "{{ golang.versions }}" | |
- paths | |
- flags: | |
skip_missing: true | |
environment: | |
PATH: "{{ ansible_env.PATH }}:{{ ansible_env.HOME }}/.goenv/bin" |
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
--- | |
golang: | |
versions: | |
- user: vagrant | |
installs: | |
- version: 1.6.1 | |
paths: | |
- /vagrant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment