From eb9419023f3eceef1b7867e51635b2ce755921b2 Mon Sep 17 00:00:00 2001 From: "Leon M. George" Date: Mon, 26 Feb 2018 18:19:50 +0100 Subject: [PATCH] group code using blocks --- tasks/main.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 25a44a9..155fa9d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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: