Skip to content

Commit

Permalink
group code using blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
yogo1212 committed Feb 26, 2018
1 parent 6bf3517 commit eb94190
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
---
- name: Discover the latest version
shell:
curl https://api.github.com/repos/golang/go/git/refs/tags/ | egrep 'ref.*refs/tags/go([0-9.]+)",' | egrep -o "[0-9.]+" | sort | tail -n 1
register: latest_release
changed_when: False
- block:
- name: Discover the latest version
shell:
curl https://api.github.com/repos/golang/go/git/refs/tags/ | egrep 'ref.*refs/tags/go([0-9.]+)",' | egrep -o "[0-9.]+" | sort | tail -n 1
register: latest_release
changed_when: False

- name: Setting version from latest release
set_fact:
go_version: "{{ latest_release.stdout_lines[0] }}"
go_tarball: "go{{ latest_release.stdout_lines[0] }}.linux-amd64.tar.gz"
when:
- go_version is not defined
- go_tarball_checksum is not defined

- name: Setting facts for autodiscovered version
set_fact:
go_version: "{{ latest_release.stdout_lines[0] }}"
go_tarball: "go{{ latest_release.stdout_lines[0] }}.linux-amd64.tar.gz"
when: not latest_release | skipped

- name: Setting facts based on previous autodiscovered facts
set_fact:
Expand Down

0 comments on commit eb94190

Please sign in to comment.