Files
ansible-automations/roles/docker/tasks/check_version.yml
Noah Knegt af9da714f7
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Remove the complex looping
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-03-31 12:29:04 +02:00

29 lines
1.1 KiB
YAML

# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 31-03-2023
# @description : This will check if docker is installed as the latest version.
# ===================================================================================================
---
- name: Check docker version
shell: docker --version
register: docker_version
- name: Install jq
become: true
package:
name: jq
state: present
- name: Check if latest version is stable
shell: "curl -s https://api.github.com/repos/docker/cli/tags | jq -r '.[0].name' | grep -E -o '[0-9]+\\.[0-9]+\\.[0-9]+\\-?'"
register: docker_latest_version
- name: Compare versions
set_fact:
docker_update: true
when: docker_version.stdout is not defined or (docker_version.stdout != docker_latest_version.stdout and docker_latest_version.stdout is not search("-"))