diff --git a/alpine-image.yaml b/alpine-image.yaml index 7b5c2e1..63bc3b0 100644 --- a/alpine-image.yaml +++ b/alpine-image.yaml @@ -19,17 +19,33 @@ - name: package_name prompt: Please specify package name private: no + - name: package_version + prompt: Please specify package version + private: no tasks: - name: sanity check assert: that: package_name | length > 0 fail_msg: no package name provided - - name: obtain package information - uri: - url: "https://pkgs.alpinelinux.org/packages?name={{ package_name }}&branch=v{{ alpine_version.split('.')[0:2] | join('.') }}&arch=x86_64" - return_content: yes - register: pkg_query + - name: obtain package version + block: + - name: obtain package information + uri: + url: "https://pkgs.alpinelinux.org/packages?name={{ package_name }}&branch=v{{ alpine_version.split('.')[0:2] | join('.') }}&arch=x86_64" + return_content: yes + register: pkg_query + + - name: extract package version + set_fact: + package_version: "{{ package_info.Version }}" + vars: + response_lines: "{{ ( pkg_query.content | trim ).split('\n') }}" + info_titles: "{{ response_lines | select('search', '